     protected var _object :DObject;;
     protected var _active :Boolean;
     protected var _pending :Boolean;
+
+    private static const log :Log = Log.getLog(SafeSubscriber);
 }
 }

        // if we are no longer active, we don't want this damned thing
        if (!_active) {
            var omgr :DObjectManager = object.getManager();
            // if the object's manager is null, that means the object is
            // already destroyed and we need not trouble ourselves with
            // unsubscription as it has already been pitched to the dogs
            if (omgr != null) {
                omgr.unsubscribeFromObject(_oid, this);
            }

    public function subscribe (omgr :DObjectManager) :void
    {
        if (_active) {
            log.warning("Active safesub asked to resubscribe " + this);
            return;
        }

        // note that we are now again in the "wishing to be subscribed" state
        _active = true;

        // make sure we dont have an object reference (which should be logically impossible)
        if (_object != null) {
            log.warning("Incroyable! A safesub has an object and was non-active!? " + this);
            // make do in the face of insanity
            _subscriber.objectAvailable(_object);
            return;
        }

        if (_pending) {
            // we were previously asked to subscribe, then they asked to unsubscribe and now
            // they've asked to subscribe again, all before the original subscription even
            // completed; we need do nothing here except as the original subscription request will
            // eventually come through and all will be well
            return;
        }

        // we're not pending and we just became active, that means we need to request to subscribe
        // to our object
        _pending = true;
        omgr.subscribeToObject(_oid, this);
    }

    /**
     * Terminates the object subscription. If the initial subscription has not yet completed, the
     * desire to terminate will be noted and the subscription will be terminated as soon as it
     * completes.
     */
    public function unsubscribe (omgr :DObjectManager) :void
    {
        if (!_active) {
            // we may be non-active and have no object which could mean that subscription failed;
            // in which case we don't want to complain about anything, just quietly ignore the
            // unsubscribe request
            if (_object == null && !_pending) {
                return;
            }
            log.warning("Inactive safesub asked to unsubscribe " + this);
            Log.dumpStack();
        }

