diff --git a/src/app/ui_context.cpp b/src/app/ui_context.cpp index 067fd51bf..0dc966ebc 100644 --- a/src/app/ui_context.cpp +++ b/src/app/ui_context.cpp @@ -78,6 +78,12 @@ void UIContext::setActiveView(DocView* docView) { MainWindow* mainWin = App::instance()->mainWindow(); + // This can happen when the main window is being destroyed when we + // close the app, and the active view is changing because we are + // closing down every single tab. + if (!mainWin) + return; + // Prioritize workspace for user input. App::instance()->inputChain().prioritize(mainWin->getWorkspace(), nullptr);