Hi John, I suspect this issue is down to the Scene object being destructed after the sceneCacheMutex and s_sceneCache are destructed as both of these are constructed till after the first Scene object is constructed. To force these objects to be constructed first I think it is probably best to move the static s_sceneCacheMutex and s_sceneCache into the global scope to ensure they get created before the first Scene object ever gets created.
Robert. On 12 March 2012 10:03, PC John <[email protected]> wrote: > Hi, > > I found a deadlock in Scene.cpp. The problem exhibits itself when calling > std::exit() instead of standard way of terminating of the application. > > The deadlock is seen on Windows only. On Linux, I get sigsegv or, at least, > valgrind gives me info about using already freed memory. > > After the investigation, I found that the problem is using of static variables > in getSceneCache() and getSceneCacheMutex() in Scene.cpp. The destructors of > these static variables are registered by the compiler (gcc) using atexit() > approach. (I could not believed it and made additional tests, but all the > same.) As a result, the mentioned variables are destructed too early and > before all global variables, resulting sigsegv and deadlocks... > > I moved the static variables to global scope and the problem disappeared. Is > it the correct fix of the problem? Should I submit a patch? > > Comments? Ideas? > John > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

