summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-03-04 21:25:39 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-05 08:31:23 +0100
commit7a5fea113ec6088135b0b6a0fc4297e0ef362bc5 (patch)
tree0101a17952fa22b466627f1d3ff4efa1bf629951 /src/gui/kernel
parent09fb084e3a16ea3cbca896e270ff7d9bd6b6c313 (diff)
Fix crash in flushWindowSystemEvents() in QGuiApplication-cleanup.
Check for existence of QGuiApplication, discard events if it is 0. Change-Id: I04b27679033fb13ef2fa38e39757d89465cba94b Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp10
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h5
2 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 8c5a3bc215..3609d5dce6 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -527,6 +527,16 @@ void QWindowSystemInterface::deferredFlushWindowSystemEvents()
void QWindowSystemInterface::flushWindowSystemEvents()
{
+ const int count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count();
+ if (!count)
+ return;
+ if (!QGuiApplication::instance()) {
+ qWarning().nospace()
+ << "QWindowSystemInterface::flushWindowSystemEvents() invoked after "
+ "QGuiApplication destruction, discarding " << count << " events.";
+ QWindowSystemInterfacePrivate::windowSystemEventQueue.clear();
+ return;
+ }
if (QThread::currentThread() != QGuiApplication::instance()->thread()) {
QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);
QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent();
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 431b2cbe1e..eca559abfa 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -387,9 +387,10 @@ public:
mutable QMutex mutex;
public:
WindowSystemEventList() : impl(), mutex() {}
- ~WindowSystemEventList()
- { const QMutexLocker locker(&mutex); qDeleteAll(impl); impl.clear(); }
+ ~WindowSystemEventList() { clear(); }
+ void clear()
+ { const QMutexLocker locker(&mutex); qDeleteAll(impl); impl.clear(); }
void prepend(WindowSystemEvent *e)
{ const QMutexLocker locker(&mutex); impl.prepend(e); }
WindowSystemEvent *takeFirstOrReturnNull()