[osg-users] Bug in RenderBin (?)

Christof Krüger osgforum at tevs.eu
Wed Mar 11 14:55:50 PDT 2009


I'm new to OpenSceneGraph and not sure if I get everything right. I get crashes with Visual Studio 2005 static build after the main function returns. The crash occurs while the static s_renderBinPrototypeList is destructed.

While debugging, I have found something suspicious:  There are two RegisterRenderBinProxy instances in RenderBin.cpp, one with the name "RenderBin" and one with "DepthSortedBin". They both add the corresponding entries to the s_renderBinPrototypeList correctly before main() enters.

However, the s_registerDepthSortedBinProxy removes the wrong entry in s_renderBinPrototypeList afterwards. This happens because the proxy class calls removeRenderBinPrototype which uses proto->className to find the entry to erase from the s_renderBinPrototypeList map. Remember that the destructor of s_registerDepthSortedBinProxy should remove the "DepthSortedBin" entry. Unfortunately, proto->className equals "RenderBin" in both cases.

When s_registerRenderBinProxy tries to delete the "RenderBin" entry later, it fails because it is already deleted. Then, s_renderBinPrototypeList still contains the DepthSortedBin entry which was never deleted.

Read this topic online here:

More information about the osg-users mailing list