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>
This commit is contained in:
parent
d8bfd812c3
commit
6794319bbd
@ -4377,7 +4377,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
|
|||||||
QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin();
|
QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin();
|
||||||
const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();
|
const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
QWidget *widget = it.key();
|
const QPointer<QWidget> widget = it.key();
|
||||||
if (!QApplicationPrivate::tryModalHelper(widget, 0))
|
if (!QApplicationPrivate::tryModalHelper(widget, 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -4417,7 +4417,8 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
|
|||||||
// has been implicitly accepted and continue to send touch events
|
// has been implicitly accepted and continue to send touch events
|
||||||
if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) {
|
if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) {
|
||||||
accepted = true;
|
accepted = true;
|
||||||
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
|
if (!widget.isNull())
|
||||||
|
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user