Freeing document causes crash



  • On 09/09/2016 at 05:41, xxxxxxxx wrote:

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

    ---------
    Hello.

    I have a renderer, in which I give as input a copied version of the document that is about to be rendered.
    Every time I start rendering, I free the previous copy and I create a new one. 
    On Cinema 4D termination, I free the previously copied document (only if exists).
    The problem is that BaseDocument::Free causes access violation in R18, while in R17 it works fine.

    Is there anything else that I have to do to free it properly ?

    Thank you.



  • On 09/09/2016 at 08:14, xxxxxxxx wrote:

    What is the "on C4D termination" for you? There's multiple places that you could label this way.

    On a side note, your approach isn't sound imho. Is there a specific reason you can not free the cloned document directly after rendering?
    Keeping the document alive when its no longer used doesn't make much sense.

    Best,
    Niklas



  • On 09/09/2016 at 16:00, xxxxxxxx wrote:

    Hello and thank you for your response.

    By saying C4D termination I mean inside PluginEnd (i should mention this).
    I will try deleting the document right after the rendering finishes.

    Thnx.



  • On 10/09/2016 at 03:41, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    <ADDRESS>
    User Information:
    Cinema 4D Version:   R18 
    Platform:   Windows  ;   
    Language(s) :    
    C++  ;

    ---------
    </ADDRESS> Hello.
    I have a renderer, in which I give as input a copied version of the document that is about to be rendered.
    Every time I start rendering, I free the previous copy and I create a new one. 
    On Cinema 4D termination, I free the previously copied document (only if exists).
    The problem is that BaseDocument::Free causes access violation in R18, while in R17 it works fine.
    Is there anything else that I have to do to free it properly ?
    Thank you.

    At PluginEnd you should free the resources allocated for your plugin, you can't rely on other plugin functionality (be it from Cinema or other 3rd party plugins) being available though.

    There are however several message like C4DPL_ENDACTIVITY that you should react to when you want to free the document in a save manner. Search for C4DPL_MESSAGES in the SDK docs ...

    Best regards,

    Wilfried



  • On 12/09/2016 at 06:28, xxxxxxxx wrote:

    Hi everyone,

    always good, when Wilfried jumps in. Thanks!

    From our side only a few links to add:
    Plugin Function Manual (in this context especially Shutdown)
    C4DPL_MESSAGES


Log in to reply