summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index cf3ae1b7c5..80e42336d6 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1506,8 +1506,14 @@ void QCoreApplicationPrivate::ref()
void QCoreApplicationPrivate::deref()
{
- if (!quitLockRef.deref() && in_exec && quitLockRefEnabled)
- QCoreApplication::postEvent(qApp, new QEvent(QEvent::Quit));
+ if (!quitLockRef.deref())
+ maybeQuit();
+}
+
+void QCoreApplicationPrivate::maybeQuit()
+{
+ if (quitLockRef.load() == 0 && in_exec && quitLockRefEnabled && shouldQuit())
+ QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::Quit));
}
/*!