From: david Date: Sun, 19 Jan 2003 17:21:18 +0000 (+0000) Subject: Use a pointer for the bindings vector to try to work around a 2.95 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ed3ae450cee3824584bab04af2fe4f7a85fa968f;p=flightgear.git Use a pointer for the bindings vector to try to work around a 2.95 bug. --- diff --git a/src/GUI/menubar.cxx b/src/GUI/menubar.cxx index f9fbbe0bb..b79894cd0 100644 --- a/src/GUI/menubar.cxx +++ b/src/GUI/menubar.cxx @@ -282,11 +282,12 @@ FGMenuBar::~FGMenuBar () delete _menuBar; // FIXME: check if PUI owns the pointer // Delete all those bindings - map >::iterator it; + map*>::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 &bindings = _bindings[name]; + vector * 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 binding_nodes = item_nodes[i]->getChildren("binding"); + + if (_bindings[items[j]] == 0) + _bindings[items[j]] = new vector; 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; diff --git a/src/GUI/menubar.hxx b/src/GUI/menubar.hxx index 4dabf20c7..12ee7a56e 100644 --- a/src/GUI/menubar.hxx +++ b/src/GUI/menubar.hxx @@ -82,7 +82,7 @@ private: bool _visible; puMenuBar * _menuBar; - map > _bindings; + map*> _bindings; }; #endif // __MENUBAR_HXX