[osg-users] Crash when application closes if linking with OSG

David Siñuela david.sinuela at pix4d.com
Mon Oct 5 06:32:54 PDT 2015


Hello Robert,

It is working fine now, I tested it on Linux and Windows.

Thanks!
David

On Mon, Oct 5, 2015 at 12:48 PM, Robert Osfield <robert.osfield at gmail.com>
wrote:

> Hi David,
>
> I have removed the InitRegistry proxy object from
> src/osgViewer/ViewerBase.cpp and introduced OSG_INIT_SINGLETON_PROXY usage
> in DatabasePager.cpp and Registry.cpp which should ensure that the
> singleton's are initialized in a single threaded way and destructed in an
> appropriate order.  I have checked this change into svn/trunk and the
> OSG-3.4 branch. Changes are:
>
> Index: src/osgDB/DatabasePager.cpp
> ===================================================================
> --- src/osgDB/DatabasePager.cpp (revision 15130)
> +++ src/osgDB/DatabasePager.cpp (working copy)
> @@ -1236,6 +1236,8 @@
>      return s_DatabasePager;
>  }
>
> +OSG_INIT_SINGLETON_PROXY(ProxyInitDatabasePager,
> DatabasePager::prototype())
> +
>  DatabasePager* DatabasePager::create()
>  {
>      return DatabasePager::prototype().valid() ?
> Index: src/osgDB/Registry.cpp
> ===================================================================
> --- src/osgDB/Registry.cpp      (revision 15130)
> +++ src/osgDB/Registry.cpp      (working copy)
> @@ -214,7 +214,9 @@
>      return s_registry.get(); // will return NULL on erase
>  }
>
> +OSG_INIT_SINGLETON_PROXY(ProxyInitRegistry, Registry::instance())
>
> +
>  // definition of the Registry
>  Registry::Registry()
>  {
> Index: src/osgViewer/ViewerBase.cpp
> ===================================================================
> --- src/osgViewer/ViewerBase.cpp        (revision 15142)
> +++ src/osgViewer/ViewerBase.cpp        (working copy)
> @@ -40,23 +40,6 @@
>
>  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)
>  {
>
> This patch is also attached, under unix you can apply this with:
>
>   cd OpenSceneGraph
>   patch -p0 < singletons.patch
>
> Could you test this out and let me know if it works fine or not.
>
> Cheers,
> Robert.
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
David Sinuela Pastor


*Pix4D SA*
*EPFL Innovation Park*
*Building D*
*1015 Lausanne - Switzerland*
*Email: <david.sinuela at pix4d.com>david.sinuela at pix4d.com
<david.sinuela at gmail.com>*
*Skype: david.sinuela.pix4d*
*www.pix4d.com* <http://www.pix4d.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151005/c722caff/attachment-0003.htm>


More information about the osg-users mailing list