Several months ago, I posted a patch to OSG::osgExit() to clean up plug-in
state. This change was necessary for me to prevent a crash-on-exit problem
resulting from a plug-in trying to clean up after itself at the wrong time.
Specifically, what I need to avoid is the case where OSG::osgInit() and
OSG::osgExit() aere called in spawned thread and the plug-in's clean up
process is performed later in the primordial thread when the application exited.

I have attached the patch for review with the hope that it will be accepted.
It is a very simple change, and it is one that has been working for me in
production code for about six months. I have only ever tested it with one
plug-in (a model loader), so I cannot be sure that this change is 100%
correct. Nevertheless, it would be very nice to get plug-ins cleaned up at
the appropriate time during application execution.

 -Patrick


-- 
Patrick L. Hartling                    | VP Engineering, Infiscape Corp.
PGP: http://tinyurl.com/2msw3          | http://www.infiscape.com/
Index: Source/Base/Base/OSGBaseFunctions.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/Base/Base/OSGBaseFunctions.cpp,v
retrieving revision 1.13
diff -u -r1.13 OSGBaseFunctions.cpp
--- Source/Base/Base/OSGBaseFunctions.cpp       21 Feb 2006 22:34:14 -0000      
1.13
+++ Source/Base/Base/OSGBaseFunctions.cpp       6 Mar 2006 20:59:21 -0000
@@ -464,6 +464,7 @@
 #ifdef OSG_GV_BETA
     returnValue &= FactoryController::the()->terminate();
 #endif
+    SharedObjectHandler::the()->terminate();
 
     if(osgSystemExitFunctions != NULL)
     {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to