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/gui/kernel/qdrag.cpp | |
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/gui/kernel/qdrag.cpp')
-rw-r--r-- | src/gui/kernel/qdrag.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp index dcd0d13d5c..8e2f7be23e 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -279,8 +279,11 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa } d->supported_actions = supportedActions; d->default_action = transformedDefaultDropAction; - d->executed_action = QDragManager::self()->drag(this); - + QPointer<QDrag> self = this; + auto executed_action = QDragManager::self()->drag(self.data()); + if (self.isNull()) + return Qt::IgnoreAction; + d->executed_action = executed_action; return d->executed_action; } |