Hi Vincent, Looking at J.P. follow up email it does sound like it could be windows specific issue. Are you using windows? Is you singleton implemented in a header? If so the just have the declaration in the header, and keep the implementation entirely within the .cpp to ensure that the allocation happens single dll.
Robert. On Tue, May 19, 2009 at 3:33 PM, Vincent Bourdier <[email protected]> wrote: > Hi Robert, > > I get more info : the singleton is not destroyed, but is called from the lib > I did and from the exe itself. When the lib call the singleton, it works > good. when the exe call the singleton, It does a new call to constructor ... > > Any idea about how to solve that problem ? > > Thanks. > > Regards, > Vincent. > > 2009/5/19 Robert Osfield <[email protected]> >> >> On Tue, May 19, 2009 at 2:24 PM, Vincent Bourdier >> <[email protected]> wrote: >> > Hi Robert, >> > >> > I think I get it : >> > >> > I seems to be due to the osgDB::DynamicLibrary instance I use, which >> > ref_ptr >> > unref when leaving the load code, so the destructor of the >> > RegisterReaderWriterProxy (my equivalent) was called, and it seems to be >> > sufficient to force a new call to the Registry constructor. >> > >> > Does it sounds right for you ? >> >> I can't comment on code I'm not party to. >> >> As a general note one shouldn't be able to delete a internally >> singleton used in my example without doing a instance()=0; Just take >> a ref_ptr<> to the return won't delete the object as the instance() >> method keeps around a copy. >> >> Robert. >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

