-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault in SoGLLazyElement::endCaching #402
Comments
Thanks for the thorough issue report, it is highly appreciated. |
I think I spotted the problem :
So using some stacks for those two variables seems to do the trick :
And using the method precachestate() instead of the variable in "SoGLLazyElement::send()" I tested this solution, and it doesn't crash anymore. Another even simpler solution could be for SoPrimitiveVertexCache constructor not to call SoGLLazyElement::beginCaching() if someone has already called it before. |
any traction on this? |
I had a closer look onto this but I am not convinced the proposed solution is the right one. The SoPrimitiveVertexCache should IMHO not setup a new cache but rather use the existing. Will need to dive further into the code. |
Softest of bumps |
Hi Coin team,
under certain circumstances it can happen that a segmentation fault occurs in the function SoGLLazyElement::endCaching() at the line
because the postcachestate variable has been nullified in a previous call of SoGLLazyElement::endCaching().
The crash occurred in FreeCAD where some custom Inventor classes are involved but I was able to implement a little demo application using only Coin3D node types.
Here is the code of the demo:
So far the crash only seems to occur if all of the conditions below are fulfilled:
The steps to reproduce:
After the SoAnnotation has been added to the scene graph the functions SoGLLazyElement::beginCaching() and SoGLLazyElement::endCaching() will be called a few times but then there is a nested call of SoGLLazyElement::beginCaching() where the function getInstance() returns two times the same instance of SoGLLazyElement.
Afterwards SoGLLazyElement::endCaching() will be called twice and inside the first call precachestate and postcachestate are nullified. In the second call postcachestate will be dereferenced and thus causes a segmentation fault because it's NULL.
For more details have a look at: https://forum.freecadweb.org/viewtopic.php?f=18&t=43305&start=10#p412537
Btw:
The crash can be reproduced with the current master of Coin3D and SoQt.
The crash can be reproduced on Windows and Linux and probably on any other OS
The text was updated successfully, but these errors were encountered: