Cinema4D Application crash R19 in Release Mode



  • Hello Cinema Coders,

    I am running into a crash when compiling and executing my plugins in Release Mode (Cinema4D R19)
    C4D crashes with an application error and a bug report is being generated:

    ~~~~******~~~~CINEMA_4D_Crash_Report_WINDOWS
    {
    	Call_Stacks
    	{
    		Call_Stack_Thread_14992
    		{
    			CINEMA 4D.exe:	0x000000014034BB33 (SP: 0x000000000E65F5B8, PC: 0x000000014034BB33)
    			CINEMA 4D.exe:	0x0000000140293409 (SP: 0x000000000E65F5C0, PC: 0x0000000140293409)
    			SHD_BaseResource.cdl64:	_GeFree + 0x1e (SP: 0x000000000E65F5F0, PC: 0x000007FEB128439E)
    			SHD_BaseResource.cdl64:	BaseData::Destructor + 0x23 (SP: 0x000000000E65F620, PC: 0x000007FEB126ED03)
    			c4dplugin.xdl64:	0x000007FEB7F1E702 (SP: 0x000000000E65F650, PC: 0x000007FEB7F1E702)
    			c4dplugin.xdl64:	0x000007FEB7F2B1E5 (SP: 0x000000000E65F6C0, PC: 0x000007FEB7F2B1E5)
    			c4dplugin.xdl64:	0x000007FEB7651993 (SP: 0x000000000E65F700, PC: 0x000007FEB7651993)
    			c4dplugin.xdl64:	0x000007FEB7940827 (SP: 0x000000000E65F740, PC: 0x000007FEB7940827)
    			c4dplugin.xdl64:	0x000007FEB99739FA (SP: 0x000000000E65F8B0, PC: 0x000007FEB99739FA)
    			CINEMA 4D.exe:	0x00000001403FA5EF (SP: 0x000000000E65F900, PC: 0x00000001403FA5EF)
    			CINEMA 4D.exe:	0x00000001404057CF (SP: 0x000000000E65F9A0, PC: 0x00000001404057CF)
    			ucrtbase.DLL:	crt_at_quick_exit + 0xc6 (SP: 0x000000000E65FA30, PC: 0x000007FEE9610D76)
    			kernel32.dll:	BaseThreadInitThunk + 0xd (SP: 0x000000000E65FA60, PC: 0x000000007717571D)
    			ntdll.dll:	RtlUserThreadStart + 0x1d (SP: 0x000000000E65FA90, PC: 0x00000000773D385D)~~~~******~~~~
    

    If I compile this plugin in Debug Mode no problem occurs.

    As a dirty try-out I modified 2 functions in the cinema.framework:

    In file c4d_memory.cpp:

    void _GeFree(void** Daten)
    {
    	if (*Daten)
    	
       try 
       {
             {
                C4DOS.Ge->Free(*Daten);
             }
    
             *Daten = nullptr;
       }
    
      catch (...)
       { 
       }
    }
    

    In file c4d_basplugin.cpp:

    void BaseData::Destructor(void)
    {
       BaseData* _this;
    
       _this = this;
      
      try 
       {
          DeleteObj(_this);
       }
    
       catch (...)
       {
         
       }
    }
    

    With the try and catch blocks in these two functions c4D works without crash in Relase mode.

    Has maybe someone an idea where to look further regarding this issue?

    Thanks a lot for your time!

    Regards Andreas



  • Hi Andreas, thanks for reaching out us and welcome to the forum.

    With regard to the mentioned issue I warmly suggest, rather than modifying the Cinema 4D API which could indeed lead to unexpected behavior, to share your code that could be responsible for the crash.

    It looks like the issue points in the direction of a wrong memory allocation/free but without any information on what takes place in your plugin I can't be of any further help. For the time being I can recommend to have a look at Entity Creation and Destruction Manual (Classic) and to Entity Creation in MAXON API.

    Looking forward further comments of yours, give best.
    Riccardo



  • @Riccardo

    Thank you very much for your reply Riccardo!
    Yes of course you are right - modifying the c4d sdk is a bad way.

    I just did this to see what happens.
    I will take a close look to the manual you have mentionend and will review
    the memory handling in my code.

    Best regards
    Andi


Log in to reply