]> git.mxchange.org Git - flightgear.git/commitdiff
Use a pointer for the bindings vector to try to work around a 2.95
authordavid <david>
Sun, 19 Jan 2003 17:21:18 +0000 (17:21 +0000)
committerdavid <david>
Sun, 19 Jan 2003 17:21:18 +0000 (17:21 +0000)
bug.

src/GUI/menubar.cxx
src/GUI/menubar.hxx

index f9fbbe0bba83c626aa063553ca9aa0b3556b813d..b79894cd0c599c2c4ee565d8625cc34d88de5a4f 100644 (file)
@@ -282,11 +282,12 @@ FGMenuBar::~FGMenuBar ()
     delete _menuBar;            // FIXME: check if PUI owns the pointer
 
                                 // Delete all those bindings
-    map<string,vector<FGBinding *> >::iterator it;
+    map<string,vector<FGBinding *>*>::iterator it;
     it = _bindings.begin();
     while (it != _bindings.end()) {
-        for (int i = 0; i < it->second.size(); i++)
-            delete it->second[i];
+        for (int i = 0; i < it->second->size(); i++)
+            delete (*it->second)[i];
+        delete it->second;
     }
 }
 
@@ -328,10 +329,10 @@ void
 FGMenuBar::fireItem (puObject * item)
 {
     const char * name = item->getLegend();
-    vector<FGBinding *> &bindings = _bindings[name];
+    vector<FGBinding *> bindings = _bindings[name];
 
-    for (int i = 0; i < bindings.size(); i++)
-        bindings[i]->fire();
+    for (int i = 0; i < bindings->size(); i++)
+        (*bindings)[i]->fire();
 }
 
 void
@@ -356,8 +357,11 @@ FGMenuBar::make_menu (SGPropertyNode_ptr node)
                                 // Load all the bindings for this item
         vector<SGPropertyNode_ptr> binding_nodes =
             item_nodes[i]->getChildren("binding");
+
+        if (_bindings[items[j]] == 0)
+            _bindings[items[j]] = new vector<FGBinding *>;
         for (int k = 0; k < binding_nodes.size(); k++)
-            _bindings[items[j]].push_back(new FGBinding(binding_nodes[k]));
+            _bindings[items[j]]->push_back(new FGBinding(binding_nodes[k]));
     }
 
     items[item_nodes.size()] = 0;
index 4dabf20c7bc528364cb78b5ec25e9dc6b4aaac9d..12ee7a56e8787344976c00fe61a99c77f816072c 100644 (file)
@@ -82,7 +82,7 @@ private:
 
     bool _visible;
     puMenuBar * _menuBar;
-    map<string,vector<FGBinding *> > _bindings;
+    map<string,vector<FGBinding *>*> _bindings;
 };
 
 #endif // __MENUBAR_HXX