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
    • Recent
    • Tags
    • Users
    • Login

    Problem with Free() method

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 229 Views
    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 Offline
      Helper
      last edited by

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

      On 19/07/2010 at 02:29, xxxxxxxx wrote:

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

      ---------
      Hi all!

      As my plugin is a bit slow, I would like to free some objects I use in my timers :

      BaseDraw* baseDraw = doc->GetActiveBaseDraw();
      BaseObject* baseCamera = baseDraw->GetSceneCamera(doc);
      

      In order to do that I've changed the initialization of these objects :

      BaseDraw* baseDraw = BaseDraw::Alloc();
      BaseObject* baseCamera = BaseObject::Alloc(Ocamera);
      

      And then :

      BaseDraw::Free(baseDraw);
      BaseObject::Free(baseCamera);
      

      There is no error when the code is compiled but when I launch C4D I got this error :

      Unhandled exception at 0x00000000 in CINEMA 4D Demo.exe: 0xC0000005: Access violation reading location 0x00000000.

      In Visual Studio it shows me the c4d_baseobject.cpp file and particularly the BaseObject::Free method :

      void BaseObject::Free(BaseObject *&bl)
      {
      	 **C4DOS.Bl- >Free(bl);**
      	bl=NULL;
      }
      

      Why is the Free method not working ?
      Thanks.

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

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

        On 19/07/2010 at 09:05, xxxxxxxx wrote:

        I solved my problem I just used the wrong refresh method for my scene! Now I use DrawViews(DA_NO_THREAD|DA_ONLY_ACTIVE_VIEW|DA_ONLY_HIGHLIGHT); and it's fine 😉

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