Fix crash in QSimpleDrag if drag wasn't started over a QWindow

The code in QSimpleDrag::startDrag() checks for the validity of the
current window before passing it on to QWindowSystemInterface::handleDrag(),
and so should QSimpleDrag::cancel().

Change-Id: I2228d86ede2a0b8379a55000a5c1d830cab44d45
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Tor Arne Vestbø 2014-02-28 16:24:32 +01:00 committed by The Qt Project
parent 14aae25d03
commit 02b18343e1

View File

@ -324,9 +324,10 @@ void QSimpleDrag::startDrag()
void QSimpleDrag::cancel()
{
QBasicDrag::cancel();
if (drag())
if (drag() && m_current_window) {
QWindowSystemInterface::handleDrag(m_current_window, 0, QPoint(), Qt::IgnoreAction);
m_current_window = 0;
m_current_window = 0;
}
}
void QSimpleDrag::move(const QMouseEvent *me)