]> git.mxchange.org Git - flightgear.git/commitdiff
Reset: free nasal-module-listeners on shutdown.
authorJames Turner <zakalawe@mac.com>
Tue, 3 Dec 2013 21:38:24 +0000 (21:38 +0000)
committerJames Turner <zakalawe@mac.com>
Tue, 3 Dec 2013 21:38:45 +0000 (21:38 +0000)
src/Scripting/NasalSys.cxx
src/Scripting/NasalSys.hxx

index 57967ebf66688aacf94bc3816b4623b9b181ad12..16a2699da197bacf31c076ab122c83cf3880d5f1 100644 (file)
@@ -826,6 +826,11 @@ void FGNasalSys::shutdown()
     }
     _commands.clear();
     
+    std::vector<FGNasalModuleListener*>::iterator k = _moduleListeners.begin();
+    for(; k!= _moduleListeners.end(); ++k)
+        delete *k;
+    _moduleListeners.clear();
+    
     naClearSaved();
     
     _string = naNil(); // will be freed by _context
@@ -1007,6 +1012,7 @@ void FGNasalSys::loadPropertyScripts(SGPropertyNode* n)
         if (enable)
         {
             FGNasalModuleListener* listener = new FGNasalModuleListener(n);
+            _moduleListeners.push_back(listener);
             enable->addChangeListener(listener, false);
         }
     }
index f8be35db1a7ea7786dd96b6e545db7dfaaf36032..d4680f1398ae9d06f6fc80b5a5ce681fb8ea1b73 100644 (file)
@@ -22,6 +22,7 @@ class FGNasalListener;
 class SGCondition;
 class FGNasalModelData;
 class NasalCommand;
+class FGNasalModuleListener;
 
 namespace simgear { class BufferedLogCallback; }
 
@@ -159,6 +160,8 @@ private:
     std::map<int, FGNasalListener *> _listener;
     std::vector<FGNasalListener *> _dead_listener;
     
+    std::vector<FGNasalModuleListener*> _moduleListeners;
+    
     static int _listenerId;
 
     void loadPropertyScripts();