From 7db8de70e16ec6cc1b317e08681deaeeca80a2cd Mon Sep 17 00:00:00 2001 From: Peter Lama Date: Thu, 22 Mar 2018 09:47:54 -0700 Subject: [PATCH] Workaround Qt 5 macOS menu bug With Qt => 5.9, it would randomly crash when opening a menu after changing workbenches. Evidently it is a Qt macOS bug related to removing actions from menus. Recreating the menus everytime avoids the issue. --- src/Gui/MenuManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Gui/MenuManager.cpp b/src/Gui/MenuManager.cpp index 9b229706d2..69bc4c82c3 100644 --- a/src/Gui/MenuManager.cpp +++ b/src/Gui/MenuManager.cpp @@ -191,7 +191,11 @@ void MenuManager::setup(MenuItem* menuItems) const return; // empty menu bar QMenuBar* menuBar = getMainWindow()->menuBar(); - //menuBar->setUpdatesEnabled(false); + +#ifdef FC_OS_MACOSX + // Unknown Qt macOS bug observed with Qt >= 5.9.4 causes random crashes when viewing reused top level menus. + menuBar->clear(); +#endif QList items = menuItems->getItems(); QList actions = menuBar->actions();