Robert, I have not been able to find the discussion you mentioned in the archives. But I solved the problem by adding a manual osgDB::Registry::instance()->closeAllLibraries(); after the clean up of the viewer.
kind regards, Roland Smeenk -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: woensdag 20 december 2006 10:05 To: osg users Subject: Re: [osg-users] Crash on exit with osg in a dynamically loaded DLL HI Roland, Have look through this months archives on this topic, there is an explanation of what the issues are with loading and unloading the OSG in its enterity. The bottom line is that you have to carefully manage the unloading of plugins and libraries to ensure that things get destructed in the correct order. Robert. On 12/19/06, Smeenk, R.J.M. (Roland) <[EMAIL PROTECTED]> wrote: > > > > > Hello all, > > I have been trying to solve a crash I am experiencing since the moment > I put osg into a DLL that is dynamically loaded at runtime. > I am using Visual Studio 2005 and OSG 1.2 (though the problem also > occurs when using the HEAD version) > > The application crashes in Referenced::unref(), specifically the > 'delete this' line. > > > Here are the last entries of the callstack: > osgd.dll!osg::Referenced::unref() Line 174 + 0x1e bytes C++ > > osgDBd.dll!osg::ref_ptr<osgDB::ReaderWriter::Options>::~ref_ptr<osgDB: > :ReaderWriter::Options>() > Line 30 + 0x24 bytes C++ > osgDBd.dll!osgDB::Registry::~Registry() Line 254 + 0xb6 bytes C++ > osgDBd.dll!osgDB::Registry::`vector deleting > destructor'() + 0x57 bytes C++ > osgd.dll!osg::Referenced::unref() Line 174 + 0x22 bytes C++ > > osgDBd.dll!osg::ref_ptr<osgDB::Registry>::~ref_ptr<osgDB::Registry>() > Line 30 + 0x24 bytes C++ > osgDBd.dll!`osgDB::Registry::instance'::`2'::`dynamic > atexit destructor for 's_registry''() + 0xd bytes C++ > osgDBd.dll!_CRT_INIT(void * hDllHandle=0x00e30000, unsigned long > dwReason=0, void * lpreserved=0x00000001) Line 417 C > osgDBd.dll!__DllMainCRTStartup(void * hDllHandle=0x00e30000, > unsigned long dwReason=0, void * lpreserved=0x00000001) Line 509 + 0x11 bytes C > osgDBd.dll!_DllMainCRTStartup(void * hDllHandle=0x00e30000, unsigned > long dwReason=0, void * lpreserved=0x00000001) Line 459 + 0x11 bytes > C > > I have made the smallest example possible that demonstrates the crash. > The main application creates an OsgSystem by using the factory method > in the dynamically loaded DLL and initializes, runs and cleans up the > system through the ISystem interface. > > The crash does not occur if one of the following lines in > OsgSystem.cpp is commented out > > > osgDB::Registry::instance()->setOptions(rwoptions.get()); > > osgText::Font* font = osgText::readFontFile("fonts/arial.ttf"); > > I am suspecting it has something to do with static data which is used > across DLL boundaries. > > kind regards, > > Roland Smeenk > > > > > > > This e-mail and its contents are subject to the DISCLAIMER at > http://www.tno.nl/disclaimer/email.html > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > > > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/ This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
