From 6794319bbdba69beb7baaff46520f3be15a1d490 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 21 May 2015 15:45:41 +0200 Subject: Fix a crash in tst_QTouchEvent::deleteInRawEventTranslation(). The test deletes a widget in QEvent::TouchBegin. This is part of a series of patches to revive the test; it is currently not run since tests/auto/gui/kernel/qtouchevent/qtouchevent.pro is missing CONFIG += testcase. Task-number: QTBUG-46266 Change-Id: I65c0a431ff1807133438764dd8b3c16bb9cb6743 Reviewed-by: Caroline Chao --- src/widgets/kernel/qapplication.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index d61737efc9..aa7940b623 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -4377,7 +4377,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QHash::ConstIterator it = widgetsNeedingEvents.constBegin(); const QHash::ConstIterator end = widgetsNeedingEvents.constEnd(); for (; it != end; ++it) { - QWidget *widget = it.key(); + const QPointer widget = it.key(); if (!QApplicationPrivate::tryModalHelper(widget, 0)) continue; @@ -4417,7 +4417,8 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, // has been implicitly accepted and continue to send touch events if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) { accepted = true; - widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); + if (!widget.isNull()) + widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); } break; } -- cgit v1.2.3