From bed50951ee360f4d01ca02272474be48fb5b604c Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 2 May 2023 13:32:42 +0200 Subject: [PATCH] Gui: fixes #9086: Disabling the splash screen blocks the startup of Freecad If no splash screen was shown then windowHandle() returns null and this leads to a segmentation fault. --- src/Gui/MainWindow.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 4c3c12c2b8..1cb9a32475 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1604,14 +1604,16 @@ void MainWindow::loadWindowSettings() } std::clog << "Main window restored" << std::endl; -// make menus and tooltips usable in fullscreen under Windows, see issue #7563 -#if defined(Q_OS_WIN) - QWindowsWindowFunctions::setHasBorderInFullScreen(this->windowHandle(), true); -#endif - bool max = config.value(QString::fromLatin1("Maximized"), false).toBool(); max ? showMaximized() : show(); + // make menus and tooltips usable in fullscreen under Windows, see issue #7563 +#if defined(Q_OS_WIN) + if (QWindow* win = this->windowHandle()) { + QWindowsWindowFunctions::setHasBorderInFullScreen(win, true); + } +#endif + statusBar()->setVisible(config.value(QString::fromLatin1("StatusBar"), true).toBool()); config.endGroup();