summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-08-28 17:51:51 -0700
committerThiago Macieira <thiago.macieira@intel.com>2018-10-19 05:47:37 +0000
commit948f8ce2ecb2d6d2713279311d6090268321f0fb (patch)
tree6c9b577bf64d7f117a63ee9a50237c7247409760
parent44eeeb8e816fbdcd77ad734cfe7a7ec28da1c5ed (diff)
QWinEventNotifier: fix crash on application shutdown
The event dispatcher can be null already but we may have outstanding QWinEventNotifier objects (like in a QProcess). Patch-By: Tamas Karpati Task-number: QTBUG-70214 Change-Id: I5e432e273def425ea334fffd154f34abfd6cb11a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--src/corelib/kernel/qwineventnotifier.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/kernel/qwineventnotifier.cpp b/src/corelib/kernel/qwineventnotifier.cpp
index 24de491326..fe086acb5d 100644
--- a/src/corelib/kernel/qwineventnotifier.cpp
+++ b/src/corelib/kernel/qwineventnotifier.cpp
@@ -256,6 +256,14 @@ static void CALLBACK wfsoCallback(void *context, BOOLEAN /*ignore*/)
{
QWinEventNotifierPrivate *nd = reinterpret_cast<QWinEventNotifierPrivate *>(context);
QAbstractEventDispatcher *eventDispatcher = nd->threadData->eventDispatcher.load();
+
+ // Happens when Q(Core)Application is destroyed before QWinEventNotifier.
+ // https://bugreports.qt.io/browse/QTBUG-70214
+ if (!eventDispatcher) { // perhaps application is shutting down
+ qWarning("QWinEventNotifier: no event dispatcher, application shutting down? Cannot deliver event.");
+ return;
+ }
+
QEventDispatcherWin32Private *edp = QEventDispatcherWin32Private::get(
static_cast<QEventDispatcherWin32 *>(eventDispatcher));
++nd->signaledCount;