Hi Philip,

On 12/7/06, Philip Lowman <[EMAIL PROTECTED]> wrote:
Robert,

You're absolutely correct.  Simply calling
    osgDB::Registry::instance()->closeAllLibraries();
within the plugin using OSG fixes the dlclose() problem.

Does dlclose() not call the destructors of singletons like
osgDB::Registry?  It doesn't look like it does, at least not within OSG.

Its order of destruction that is critical - the OSG plugins unregister
themselves with osgDB::Registry to keep everything consistent, if
osgDB is unloaded before the plugins then you'll end up with a crash.

Since adding this in our plugin seemed less than optimal, I tested some
code to use the __attribute__((destructor)) method documented in the
dlclose manpage to call closeAllLibraries() and the other methods within
osgDB::~Registry() as an extern'd function in Registry.cpp.  I got the
special function to execute on dlclose() but unfortunately my code was
still segfaulting (although with a completely different backtrace).

You can do :

osgDB::Registry::instance(0) to destroy the Registry singleton.


Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to