Check for valid receiver before sending gesture events.

Gesture events sent to a disappearing tooltip can crash. This can most
easily be seen by scrolling over a tooltip on OSX with a magic mouse
middle scroll gesture.

Task-number: QTBUG-42826
Change-Id: Id5510895f63297ca157e3d24a3f4e3a6034586e8
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Jason Haslam 2014-11-21 14:33:59 -07:00 committed by Shawn Rutledge
parent 13972476ad
commit 033318f7a7

View File

@ -2168,6 +2168,9 @@ void QGuiApplicationPrivate::processTabletLeaveProximityEvent(QWindowSystemInter
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES
void QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent *e) void QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent *e)
{ {
if (e->window.isNull())
return;
QNativeGestureEvent ev(e->type, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue); QNativeGestureEvent ev(e->type, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue);
ev.setTimestamp(e->timestamp); ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(e->window, &ev); QGuiApplication::sendSpontaneousEvent(e->window, &ev);