diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index 49f7d0827..a372c01ed 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -225,6 +225,7 @@ namespace BlackGui if (!m_splashScreen) { return; } this->displaySplashMessage(m); this->processEventsToRefreshGui(); + if (!sGui) { return; } } } diff --git a/src/blackgui/loadindicator.cpp b/src/blackgui/loadindicator.cpp index 7c828fce8..898aaef82 100644 --- a/src/blackgui/loadindicator.cpp +++ b/src/blackgui/loadindicator.cpp @@ -51,16 +51,18 @@ namespace BlackGui m_angle = 0; this->show(); this->setEnabled(true); + + QPointer myself(this); if (m_timerId == -1) { m_timerId = startTimer(m_delayMs); } if (processEvents && sGui) { sGui->processEventsToRefreshGui(); + if (!myself) { return -1; } // deleted in meantime (process events) } const int stopId = m_currentId++; // copy if (timeoutMs > 0) { - QPointer myself(this); QTimer::singleShot(timeoutMs, this, [ = ] { if (!myself) { return; } diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index 318a8b3f6..6bccb980d 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -39,6 +39,7 @@ #include #include #include +#include class QCloseEvent; class QEvent; @@ -122,8 +123,9 @@ void SwiftGuiStd::performGracefulShutdown() ui->comp_MainInfoArea->dockAllWidgets(); // allow some other parts to react - if (!sGui) { return; } // overall shutdown - sGui->processEventsToRefreshGui(); + const QPointer myself(this); + if (sGui) { sGui->processEventsToRefreshGui(); } + if (!sGui || !myself) { return; } // killed in meantime? // tell context GUI is going down if (sGui->getIContextApplication()) @@ -132,7 +134,7 @@ void SwiftGuiStd::performGracefulShutdown() } // allow some other parts to react - sGui->processEventsToRefreshGui(); + if (sGui) { sGui->processEventsToRefreshGui(); } } void SwiftGuiStd::closeEvent(QCloseEvent *event)