Problem with Free() method



  • 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.



  • 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 ;)


Log in to reply