QMacPanGestureRecognizer - stop timer on 'reset'

_panTimer has a target - for example, widget. 'reset' should stop this timer.
The problem (quite subtle and difficult to reproduce) found in tst_QTouchEvent:
widgets created/destoryed by different tests but we still can have a timer
waiting for event dispatcher to 'processEvents', firing with now-invalid
dangling pointer - 'target'.

Change-Id: Iccaf3368a8ee6a0a2f60e9dcdf5d40fb7392ca21
Task-number: QTBUG-49844
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
bb10
Timur Pocheptsov 2016-01-04 16:10:03 +01:00
parent 0cee94017f
commit 60c333caba
1 changed files with 1 additions and 0 deletions

View File

@ -256,6 +256,7 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture)
QPanGesture *g = static_cast<QPanGesture *>(gesture);
_startPos = QPointF();
_panCanceled = true;
_panTimer.stop();
g->setOffset(QPointF(0, 0));
g->setLastOffset(QPointF(0, 0));
g->setAcceleration(qreal(1));