Crash when closing Cinema

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 02/05/2008 at 02:58, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.5 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hi, I've got a problem when closing Cinema. My tag plugin has to write some data when it is shut down. The folowing method is called inside the free()-method:

> \> \> void MoCap::SetBackIDs (){ \> \>      BaseDocument \*doc = GetActiveDocument(); \>      GePrint ("doc"); \>      if (!doc->GetFirstObject()){ \>           GePrint ("if"); \>           return; \>      } \>      BaseObject \*op = doc->GetFirstObject(); \>      GePrint ("op"); \>      BaseObject \*current; \>      GePrint ("current"); \>      BaseContainer \*opContainer = op->GetDataInstance(); \>      GePrint ("opContainer"); \>       \>      GePrint("MoCap::Free"); \> \>      while (op!= NULL){ \>           GePrint ("while"); \>      opContainer = op->GetDataInstance(); \>      opContainer->SetBool (DESC_USED, FALSE); \>      opContainer->SetLong (DESC_JOINT_ID, 0); \>      current = op->GetDown(); \>      if (current == NULL) \>           current = op->GetNext(); \>      if (current == NULL) \>           current = op->GetUp()->GetNext(); \>      op = current; \>      } \> \>      GePrint ("End Free()"); \> } \> \>

This works fine. The problem is, when closing Cinema the document already seems empty when calling this free-method. The console prints out "doc", but doesn't get any further. Does someone have an idea?

Thanks

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 02/05/2008 at 03:43, xxxxxxxx wrote:

You shouldn't use GetActiveDocument() within a tag. You should use the document the node (tag) is attached to.

node->GetDocument()

The node is passed to the classes' methods

Free(GeListNode *node)

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 02/05/2008 at 04:10, xxxxxxxx wrote:

Thx very much

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 02/05/2008 at 12:40, xxxxxxxx wrote:

...you should also be testing your variables before accessing them...

    
    
      
    BaseDocument *doc = GetActiveDocument();  
     **if( doc )**  
     {  
      BaseObject *op = doc->GetFirstObject();  
      **if( op )  
    **   {  
        BaseContainer *opContainer = op->GetDataInstance();  
        **if( opContainer )  
    **     {  
            ...yadda..  
        }  
      }  
    }  
    

...or similar, etc.