From f4e71bad3ae33fdbd723a7d4dd63ae481ff29a7f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 5 Oct 2015 11:18:46 +0000 Subject: [PATCH] OSG_INIT_SINGLETON_PROXY into DatabasePager::prototype() and Registry::instance(), removing the InitRegistry proxy object in src/osgViewer/ViewerBase.cpp. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15148 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgDB/DatabasePager.cpp | 2 ++ src/osgDB/Registry.cpp | 2 ++ src/osgViewer/ViewerBase.cpp | 17 ----------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index b96333295..554da079a 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -1236,6 +1236,8 @@ osg::ref_ptr& DatabasePager::prototype() return s_DatabasePager; } +OSG_INIT_SINGLETON_PROXY(ProxyInitDatabasePager, DatabasePager::prototype()) + DatabasePager* DatabasePager::create() { return DatabasePager::prototype().valid() ? diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 14a8d0476..7a3aad6f6 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -214,6 +214,8 @@ Registry* Registry::instance(bool erase) return s_registry.get(); // will return NULL on erase } +OSG_INIT_SINGLETON_PROXY(ProxyInitRegistry, Registry::instance()) + // definition of the Registry Registry::Registry() diff --git a/src/osgViewer/ViewerBase.cpp b/src/osgViewer/ViewerBase.cpp index ea70af49b..1860f9656 100644 --- a/src/osgViewer/ViewerBase.cpp +++ b/src/osgViewer/ViewerBase.cpp @@ -40,23 +40,6 @@ static osg::ApplicationUsageProxy ViewerBase_e5(osg::ApplicationUsage::ENVIRONME using namespace osgViewer; - -struct InitRegistry -{ - InitRegistry() - { - osgDB::Registry::instance(); - } - - ~InitRegistry() - { - osgDB::DatabasePager::prototype() = 0; - osgDB::Registry::instance(true); - } -}; - -static InitRegistry s_InitRegistry; - ViewerBase::ViewerBase(): osg::Object(true) {