Introduced a destruct method to help clean up the Registry.

This commit is contained in:
Robert Osfield
2007-06-07 11:19:02 +00:00
parent 9064895b91
commit 3b1c5c3b96
2 changed files with 10 additions and 1 deletions

View File

@@ -438,6 +438,9 @@ class OSGDB_EXPORT Registry : public osg::Referenced
};
protected:
void destruct();
// forward declare helper classes
struct ReadObjectFunctor;
struct ReadImageFunctor;

View File

@@ -121,7 +121,8 @@ Registry* Registry::instance(bool erase)
{
static ref_ptr<Registry> 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.