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>
This commit is contained in:
parent
09fb084e3a
commit
7a5fea113e
@ -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();
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user