From ba5f7e6d75dee09ec7076ad24895b04e56f21b63 Mon Sep 17 00:00:00 2001 From: Oliver Oxtoby Date: Fri, 28 Jul 2023 09:32:00 +0200 Subject: [PATCH] Gui: Avoid segfault if window is not an MDIView Fixes #10003. See also #9758. --- src/Gui/MainWindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 270a0750a1..dc6ed50725 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1170,9 +1170,12 @@ void MainWindow::onWindowActivated(QMdiSubWindow* w) auto view = dynamic_cast(w->widget()); // set active the appropriate window (it needs not to be part of mdiIds, e.g. directly after creation) - d->activeView = view; - Application::Instance->viewActivated(view); - + if (view) + { + d->activeView = view; + Application::Instance->viewActivated(view); + } + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); bool saveWB = hGrp->GetBool("SaveWBbyTab", false); if (saveWB) {