Shader crashes when quitting with unfinished IRR
-
I coded a shader and it is working fine.
However, when I have IRR on and I quit Cinema4D before the IRR finishes rendering, I get a crash. If the IRR finishes and I quit, everything works fine.
What could it be? -
Hey @rui_mac,
Thank you for reaching out to us. Without your code we can just guess.
- This is likely an access violation, i.e., your plugin somehow causes your machine trying to access already deleted memory.
- The first thing I would do, is check if this is indeed caused by your plugin. Simply replace your shader with a builtin shader in a scene which crashes and see if it also crashes.
- Given your recent questions this probably has something to do with
ShaderData::InitRender
and::FreeRender
and the fact that you are poking around in the ray objects. - The major distinguishing factor between an IRR and a Picture Viewer render is that the latter does clone the document while the former does not. I would check if your plugin also crashes for 'normal' viewport renders (also do not clone the document). On its own this does not make a difference, but when you have bad code, like for example a shader that tries to modify its document, or code that assumes that the shader always lives in the active document, this can lead to crashes (always use
BaseList2D::GetDocument()
to access the document of a node). - Finally, for anything substantial, you should submit a crash report when Cinema 4D asks you to do so, make your code available to us, and submit a bug report. Please follow the guidelines given here for bug reports.
Cheers,
Ferdinand -
It seems not to crash now. I made sure I freed all the bitmaps and flushed all containers.