]> git.mxchange.org Git - flightgear.git/commitdiff
Tatsuhiro Nishioka:
authortorsten <torsten>
Fri, 4 Sep 2009 05:42:58 +0000 (05:42 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 9 Sep 2009 06:56:31 +0000 (08:56 +0200)
FG crashes at exit at very high likelihood.
The cause of the crash is that some subsystems (input and gui) call get_subsystems() at their destructor.
This is very dangerous since SGSubSystemMgr::get_subsystem() can refer to already deleted subsystems.

src/Main/globals.cxx

index b7305647638a4c730e7588cd4a4872e961517416..2d00791a2a7ba7f9f469148808ed35f5b7a12782 100644 (file)
@@ -121,6 +121,13 @@ FGGlobals::~FGGlobals()
     // shut down all subsystems, make sure we take down the 
     // AIModels system first.
     subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("ai_model");
+    // FGInput (FGInputEvent) and FGDialog calls get_subsystem() in their destructors, 
+    // which is not safe since some subsystem are already deleted but can be referred.
+    // So these subsystems must be deleted prior to deleting subsystem_mgr unless
+    // ~SGSubsystemGroup and SGSubsystemMgr::get_subsystem are changed not to refer to
+    // deleted subsystems.
+    subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("input");
+    subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("gui");
     delete subsystem_mgr;
     delete event_mgr;
     delete time_params;