diff options
author | Yulong Bai <yulong.bai@qt.io> | 2019-10-10 23:05:16 +0200 |
---|---|---|
committer | Yulong Bai <yulong.bai@qt.io> | 2019-10-27 17:40:44 +0200 |
commit | a21d4395f4f9afea52b6c2da359ce6ad21ebc763 (patch) | |
tree | 8aa2791b581ba2099676343a7a616350b21b63b8 /src/plugins/platforms/xcb | |
parent | 73cb5cb01e9531d2b2249597a64d57fa0029c300 (diff) |
Drag'n'Drop: fix attached Drag object deleted when DnD is progressing
The attached Drag object's owner, i.e. its parent, is also the dragged
item. So the attached Drag object will also be destroyed as the dragged
item is deleted.
Fixes: QTBUG-65701
Change-Id: I39b0a3180f205c427deed5c70cd1912524f9324e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 1ce947165d..3d525598ca 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -354,6 +354,11 @@ bool QXcbDrag::findXdndAwareTarget(const QPoint &globalPos, xcb_window_t *target void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { + // currentDrag() might be deleted while 'drag' is progressing + if (!currentDrag()) { + cancel(); + return; + } // The source sends XdndEnter and XdndPosition to the target. if (source_sameanswer.contains(globalPos) && source_sameanswer.isValid()) return; @@ -1076,7 +1081,8 @@ void QXcbDrag::cancel() send_leave(); // remove canceled object - currentDrag()->deleteLater(); + if (currentDrag()) + currentDrag()->deleteLater(); canceled = true; } |