 
             removed = false;
         }
+        else if (obj == null)
+        {
+            // It seems our override is no longer active, but we were never
+            // able to successfully apply ourselves, so remove our context
+            // listener if applicable.
+            removeContextListener();
+        }
+        
+        // Clear our flags and override context.
+        applied = false;
+        parentContext = null;
     }
 }
 

 *  @playerversion AIR 1.1
 *  @productversion Flex 3
 */
public class RemoveChild extends OverrideBase implements IOverride
{
    include "../core/Version.as";


            oldParent.removeChild(obj);
            removed = true;
        }
        else if (obj == null && !applied)
        {
            // Our target context is unavailable so we attempt to register
            // a listener on our parent document to detect when/if it becomes
            // valid.
            addContextListener(target); 
        }
        
        // Save state in case our value or target is changed while applied. This
        // can occur when our value property is databound or when a target is 
        // deferred instantiated.
        applied = true;
    }

    /**
