mb->fireItem(object);
}
-
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of FGPUIMenuBar.
////////////////////////////////////////////////////////////////////////
void
FGPUIMenuBar::init ()
{
- delete _menuBar; // FIXME: check if PUI owns the pointer
+ destroy_menubar();
+
make_menubar();
// FIXME: temporary commands to get at
// old, hard-coded dialogs.
// Load all the bindings for this item
vector<SGPropertyNode_ptr> bindings = item_nodes[i]->getChildren("binding");
SGPropertyNode * dest = fgGetNode("/sim/bindings/menu", true);
-
+
for (unsigned int k = 0; k < bindings.size(); k++) {
unsigned int m = 0;
SGPropertyNode_ptr binding;
// plib.
SG_LOG(SG_GENERAL, SG_BULK, "Deleting char arrays");
for (i = 0; i < _char_arrays.size(); i++) {
- for (int j = 0; _char_arrays[i][j] != 0; j++)
+ for (int j = 0; _char_arrays[i][j] != 0; j++) {
free(_char_arrays[i][j]); // added with strdup
+ _char_arrays[i][j] = 0;
+ }
delete[] _char_arrays[i];
+ _char_arrays[i] = 0;
}
-
+
// Delete all the callback arrays
// we were forced to keep around for
// plib.
delete it->second[i];
}
+ _menuBar = NULL;
+ _bindings.clear();
+ _char_arrays.clear();
+ _callback_arrays.clear();
SG_LOG(SG_GENERAL, SG_BULK, "Done.");
}