diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index bd2a43a678..b87860c512 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -452,8 +452,8 @@ Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : QApplication(argc, argv), - _dependencyManagerIsSetup(setupEssentials(argc, argv)), _window(new MainWindow(desktop())), + _dependencyManagerIsSetup(setupEssentials(argc, argv)), _undoStackScriptingInterface(&_undoStack), _frameCount(0), _fps(60.0f), @@ -1744,6 +1744,11 @@ bool Application::importSVOFromURL(const QString& urlString) { } bool Application::event(QEvent* event) { + + if (!Menu::getInstance()) { + return false; + } + if ((int)event->type() == (int)Lambda) { ((LambdaEvent*)event)->call(); return true; diff --git a/interface/src/Application.h b/interface/src/Application.h index 029590966c..31fbc7eb3c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -381,6 +381,8 @@ private: void maybeToggleMenuVisible(QMouseEvent* event); + MainWindow* _window; + bool _dependencyManagerIsSetup; OffscreenGLCanvas* _offscreenContext { nullptr }; @@ -390,8 +392,6 @@ private: bool _activatingDisplayPlugin { false }; QMap _lockedFramebufferMap; - MainWindow* _window; - QUndoStack _undoStack; UndoStackScriptingInterface _undoStackScriptingInterface; diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 5c1f2a4a61..35bc2aa696 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -46,7 +46,7 @@ #include "Menu.h" Menu* Menu::getInstance() { - return static_cast(qApp->getWindow()->menuBar()); + return dynamic_cast(qApp->getWindow()->menuBar()); } Menu::Menu() {