summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-06-08 10:20:46 +0300
committerQt by Nokia <qt-info@nokia.com>2012-06-08 18:39:02 +0200
commitf2df9cef75bb035cacf341871406c40e39d21495 (patch)
tree0fb9450642ba880c1756ed30ccd7ebeff10e3a86
parenta15aa822b7eccd392dbdc485229ababf62cadb4d (diff)
Fix crash in qt_qpa_core_dispatcher() at application exit.
In some situations it is possible to get events when QCoreApplication has already cleared the 'self' pointer and will thus not return an instance. For example, destroying screen at application exit when there are parentless dialogs open will result in hiding the dialog, which at least in Windows causes a call to QWindowSystemInterface::handleExposeEvent() which will need the core dispatcher down the line. Fixed the crash by checking if the QCoreApplication instance is valid instead of blindly using it. This should cause no problem as unhandled events are simply queued. Task-number: QTBUG-26061 Change-Id: Ide2350a62208433728e0271192c1da4b1efacc9b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
-rw-r--r--src/gui/kernel/qguiapplication_p.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index d538c393d7..76f0a71270 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -93,7 +93,12 @@ public:
{ return platform_theme; }
static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
- { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
+ {
+ if (QCoreApplication::instance())
+ return QCoreApplication::instance()->d_func()->threadData->eventDispatcher;
+ else
+ return 0;
+ }
static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e);
static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);