summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-05-21 15:45:41 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-05-22 04:34:54 +0000
commit6794319bbdba69beb7baaff46520f3be15a1d490 (patch)
treef624133c0aae2d739b380c68dfa760acf108af84 /src/widgets
parentd8bfd812c3383e24196588f5d3e1de4719fcac02 (diff)
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 <caroline.chao@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qapplication.cpp5
1 files changed, 3 insertions, 2 deletions
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<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin();
const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();
for (; it != end; ++it) {
- QWidget *widget = it.key();
+ const QPointer<QWidget> 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;
}