Improved graceful shutdown, added "m_shutdownInProgress"

* no assert when wait is called in same thread, just ignore wait
* quitAndWait readers, also works if not already noved in new thread (see above)
This commit is contained in:
Klaus Basan
2018-03-19 21:04:17 +01:00
parent 9dabef447f
commit d6fd53287f
8 changed files with 71 additions and 29 deletions

View File

@@ -34,10 +34,10 @@
#include <QCloseEvent>
#include <QApplication>
#include <QCommandLineParser>
#include <QApplication>
#include <QDesktopServices>
#include <QDir>
#include <QEventLoop>
#include <QApplication>
#include <QGuiApplication>
#include <QIcon>
#include <QKeySequence>
@@ -86,6 +86,9 @@ namespace BlackGui
this->addWindowModeOption();
this->addWindowResetSizeOption();
// notify when app goes down
connect(qGuiApp, &QGuiApplication::lastWindowClosed, this, &CGuiApplication::gracefulShutdown);
if (!sGui)
{
CGuiApplication::registerMetadata();
@@ -879,11 +882,12 @@ namespace BlackGui
void CGuiApplication::gracefulShutdown()
{
if (m_shutdownInProgress) { return; }
CApplication::gracefulShutdown();
if (m_saveMainWidgetState)
{
this->saveWindowGeometryAndState();
}
CApplication::gracefulShutdown();
}
void CGuiApplication::settingsChanged()