diff --git a/src/GUI/FGNasalMenuBar.cxx b/src/GUI/FGNasalMenuBar.cxx index 410b4ec49..457d73525 100644 --- a/src/GUI/FGNasalMenuBar.cxx +++ b/src/GUI/FGNasalMenuBar.cxx @@ -143,8 +143,12 @@ private: void NasalMenuItem::initFromNode(SGPropertyNode_ptr config) { auto n = config->getChild("name"); - _name = n->getStringValue(); - n->addChangeListener(this); + if (!n) { + SG_LOG(SG_GUI, SG_DEV_WARN, "menu item without element:" << config->getLocation()); + } else { + _name = n->getStringValue(); + n->addChangeListener(this); + } if (n->getBoolValue("seperator") || nameIsSeperator(_name)) { _isSeperator = true; @@ -177,7 +181,8 @@ void NasalMenuItem::initFromNode(SGPropertyNode_ptr config) _shortcut = n->getStringValue(); } - _bindings = readBindingList(n->getChildren("binding"), globals->get_props()); + auto bindingNodes = n->getChildren("binding"); + _bindings = readBindingList(bindingNodes, globals->get_props()); n = config->getChild("menu"); if (n) { diff --git a/src/GUI/FileDialog.cxx b/src/GUI/FileDialog.cxx index f45dbeb52..3a8321100 100644 --- a/src/GUI/FileDialog.cxx +++ b/src/GUI/FileDialog.cxx @@ -28,7 +28,10 @@ #include
#include + +#if defined(HAVE_PUI) #include "PUIFileDialog.hxx" +#endif #if defined(SG_MAC) #include "CocoaFileDialog.hxx" @@ -147,8 +150,11 @@ static naRef f_createFileDialog(const nasal::CallContext& ctx) FileDialogPtr fd(new CocoaFileDialog(usage)); #elif defined(HAVE_QT) FileDialogPtr fd(new QtFileDialog(usage)); -#else +#elif defined(HAVE_PUI) FileDialogPtr fd(new PUIFileDialog(usage)); +#else + // we need a fallback implementation + FileDialogPtr fd; #endif return ctx.to_nasal(fd); diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index c5ad3882a..760ac8d6c 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -28,7 +28,6 @@ #include "GL/glx.h" #endif -#include "FGPUIMenuBar.hxx" #if defined(SG_MAC) #include "FGCocoaMenuBar.hxx" @@ -54,6 +53,7 @@ #if defined(HAVE_PUI) #include "FGPUIDialog.hxx" +#include "FGPUIMenuBar.hxx" #endif #include "FGFontCache.hxx" @@ -177,7 +177,9 @@ NewGUI::shutdown() _menubar.reset(); _dialog_props.clear(); +#if defined(HAVE_PUI) puCleanUpJunk(); +#endif } void @@ -208,12 +210,14 @@ NewGUI::createMenuBarImplementation() // _menubar.reset(new FGWindowsMenuBar); } #endif +#if defined(HAVE_PUI) + if (!_menubar.get() && _usePUI) { + _menubar.reset(new FGPUIMenuBar); + } +#endif + if (!_menubar.get()) { - if (_usePUI) { - _menubar.reset(new FGPUIMenuBar); - } else { - _menubar.reset(new FGNasalMenuBar); - } + _menubar.reset(new FGNasalMenuBar); } }