Merge pull request #7382 from hyperlogic/tony/crash-fix-focus-out-event

Application: prevent crash on startup when "Crashed" dialog is shown
This commit is contained in:
Brad Hefta-Gaub 2016-03-17 15:51:15 -07:00
commit 6f8f5ed15c
3 changed files with 9 additions and 4 deletions

View file

@ -452,8 +452,8 @@ Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
QApplication(argc, argv), QApplication(argc, argv),
_dependencyManagerIsSetup(setupEssentials(argc, argv)),
_window(new MainWindow(desktop())), _window(new MainWindow(desktop())),
_dependencyManagerIsSetup(setupEssentials(argc, argv)),
_undoStackScriptingInterface(&_undoStack), _undoStackScriptingInterface(&_undoStack),
_frameCount(0), _frameCount(0),
_fps(60.0f), _fps(60.0f),
@ -1744,6 +1744,11 @@ bool Application::importSVOFromURL(const QString& urlString) {
} }
bool Application::event(QEvent* event) { bool Application::event(QEvent* event) {
if (!Menu::getInstance()) {
return false;
}
if ((int)event->type() == (int)Lambda) { if ((int)event->type() == (int)Lambda) {
((LambdaEvent*)event)->call(); ((LambdaEvent*)event)->call();
return true; return true;

View file

@ -381,6 +381,8 @@ private:
void maybeToggleMenuVisible(QMouseEvent* event); void maybeToggleMenuVisible(QMouseEvent* event);
MainWindow* _window;
bool _dependencyManagerIsSetup; bool _dependencyManagerIsSetup;
OffscreenGLCanvas* _offscreenContext { nullptr }; OffscreenGLCanvas* _offscreenContext { nullptr };
@ -390,8 +392,6 @@ private:
bool _activatingDisplayPlugin { false }; bool _activatingDisplayPlugin { false };
QMap<gpu::TexturePointer, gpu::FramebufferPointer> _lockedFramebufferMap; QMap<gpu::TexturePointer, gpu::FramebufferPointer> _lockedFramebufferMap;
MainWindow* _window;
QUndoStack _undoStack; QUndoStack _undoStack;
UndoStackScriptingInterface _undoStackScriptingInterface; UndoStackScriptingInterface _undoStackScriptingInterface;

View file

@ -46,7 +46,7 @@
#include "Menu.h" #include "Menu.h"
Menu* Menu::getInstance() { Menu* Menu::getInstance() {
return static_cast<Menu*>(qApp->getWindow()->menuBar()); return dynamic_cast<Menu*>(qApp->getWindow()->menuBar());
} }
Menu::Menu() { Menu::Menu() {