Hi.

I'm trying to build OSG into my application. I've started with OSG logging.
I've attached sample code that depicts the problem.
After you run the program and than stop it by pressing ESC, you can
see the following output:

$ ./test
abc
DatabasePager::RequestQueue::~RequestQueue() Destructing queue.
DatabasePager::RequestQueue::~RequestQueue() Destructing queue.
DatabasePager::RequestQueue::~RequestQueue() Destructing queue.
DatabasePager::RequestQueue::~RequestQueue() Destructing queue.
~RegisterWindowingSystemInterfaceProxy()
GraphicsContext::setWindowingSystemInterface() 0        0x7ffd0fd71470

abc is printed after all delete operators take place. Somehow Viewer
is deleted after I actually delete it.

~RegisterWindowingSystemInterfaceProxy() comes from the destruction of
this static variable:
http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp?rev=12923#L2137

GraphicsContext::setWindowingSystemInterface() 0        0x7ffd0fd71470 comes
from the destructor of the above variable:
http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp?rev=12923#L2132

This means OSG uses static variables which initialization and
deinitialization times are unknown, which results in:
1) I can't really control my OSG logger lifetime;
2) I miss RegisterWindowingSystemInterfaceProxy() initialization in
logger (and possibly many others).
The only option is to create Logger specifically for OSG and let it
die at an unknown time (after all my cleanup procedures), possibly
causing me problems later.

Can we please make it non-static?

Attachment: osg_static.tar
Description: Unix tar archive

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to