Registry* Registry::instance(bool erase) { static osg::ref_ptr<Registry> s_registry = new Registry; if (erase) { s_registry->destruct(); s_registry = 0; } return s_registry.get(); // will return NULL on erase }
Registry* Registry::instance(bool erase) { // Make sure the gdal mutex is created before the Registry so it will still be around when the registry is destroyed statically. // This is to prevent crash on exit where the gdal mutex is deleted before the registry is. osgEarth::getGDALMutex(); static osg::ref_ptr<Registry> s_registry = new Registry; if (erase) { s_registry->destruct(); s_registry = 0; } return s_registry.get(); // will return NULL on erase }