Invalidating Wrappers
 
 
 

As mentioned earlier, wrappers can be invalidated. A wrapper references Alias data. When the Alias data is deleted, rather than deleting the wrapper we just invalidate it. (If we deleted it, an API user might try to dereference it and cause a core dump.) An invalidated wrapper is one which does not reference any Alias data. Accessing any of the methods of an invalid wrapper does not cause a fatal error, but causes a failure code (usually sInvalidObject) or an error value to be returned.

You can use the function AlIsValid() on objects derived from AlObject to determine if they are valid or not. AlIsValid() will return FALSE for an input of NULL.

In OpenAlias and OpenModel, when moving between stages, wrappers which reference objects in inactive stages become invalid until the stage becomes active again. They are also made invalid if the universe that they are in is deleted.