diff --git a/include/osgDB/Registry b/include/osgDB/Registry index 3223898cc..7b47b7082 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -438,6 +438,9 @@ class OSGDB_EXPORT Registry : public osg::Referenced }; protected: + + void destruct(); + // forward declare helper classes struct ReadObjectFunctor; struct ReadImageFunctor; diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 9732cb782..ebe8ee57b 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -121,7 +121,8 @@ Registry* Registry::instance(bool erase) { static ref_ptr s_registry = new Registry; if (erase) - { + { + s_registry->destruct(); s_registry = 0; } return s_registry.get(); // will return NULL on erase @@ -241,6 +242,11 @@ Registry::Registry() Registry::~Registry() +{ + destruct(); +} + +void Registry::destruct() { // switch off the pager and its associated thread before we clean up // rest of the Registry.