Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Free() causes a crash

    SDK Help
    0
    2
    168
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 09/06/2014 at 17:16, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   14 
      Platform:      Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      My tag plugin hides all the faces of a polygonal object.
      I want it to unhide all the faces if the plugin is deleted (or moved to another object, but that is not so important).
      So, inside the Free method, I wrote the following:

      void polypaint::Free(GeListNode* node)
      {
           BaseTag *tag=(BaseTag* ) node;
           BaseObject *op=tag->GetObject();
           
           ModelingCommandData cd;
           cd.doc = doc_store;
           cd.op = op;
           cd.mode = MODELINGCOMMANDMODE_POLYGONSELECTION;
           cd.flags = MODELINGCOMMANDFLAGS_0;
           
           SendModelingCommand(MCOMMAND_UNHIDE, cd);
           EventAdd(EVENT_0);
           
           return;
      }

      doc_store is a public variable in my tag class that stores the current document (from within the Draw method), since I read that trying to get the document using the usual methods, returns a NULL inside the Free method.
      But, as soon as I delete the tag, Cinema4D crashes.
      This is the exact same code that I'm using somewhere inside the Draw method and all is going fine.
      What could be happening to result in a crash?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 10/06/2014 at 03:34, xxxxxxxx wrote:

        Ok, found it. I wasn't being able to get the op, so I just stored it as a public variable, just like the doc and it worked.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post