From 02b18343e104512979edcc5d9ffa97cc16fe5123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Feb 2014 16:24:32 +0100 Subject: 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 --- src/gui/kernel/qsimpledrag.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index f6912a2d57..dcf476e4fe 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -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) -- cgit v1.2.3