I am using the OpenSG CVS snapshot from July 12, 2005, built using Visual C++ 7.1 with VR Juggler 2.0.0. I am trying out the very handy OpenSG plug-in loading capabilities added back in early June for a custom model loader, and things are working very well. On the very first try, the DLL was found, loaded, and put to work. However, when the application shuts down, it crashes when the custom DLL is being detached from the process. The static memory for the scene file type object is being deleted, but when it tries to deallocate the OpenSG objects it is holding, it fails.
My diagnosis is that the problem arises from two things:
1. This is a VR Juggler application, and OSG::osgInit() and
OSG::osgExit() are called from a thread that is not the
primordial thread. As far as I understand it, this puts OpenSG
thread aspects into play and requires that objects be deleted in
the thread (aspect) where they were allocated originally.
2. The loader is being detached in the primordial thread as part of
the MSVC runtime shutting down the process.
The threading aspect makes things tricky but not intractable. In this case,
I think the problem could be solved if OpenSG unloaded all of its plug-ins
in OSG::osgExit().
To that end, I am wondering why OSG::SharedObjectHandler::terminate() is not
called in OSG::osgExit(). Is this an oversight, or is there a non-trivial
problem that arises from doing so? I have not tried modifying
OSG::osgExit() to try this yet as I would need to make a full build of
OpenSG myself. I am certainly willing to do that if someone wants a report
of whether that change solves my problem (and I may do it anyway to be able
to continue debugging this on my own).
At any rate, thanks very much for the addition of plug-in loading to OpenSG.
It is very easy to use and just a generally handy feature.
-Patrick
--
Patrick L. Hartling | VP Engineering, Infiscape Corp.
PGP: http://tinyurl.com/2msw3 | http://www.infiscape.com/
signature.asc
Description: OpenPGP digital signature
