From 6cef89c6442d06934c3545919e6b8283b3d8d1a4 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 23 Jun 2010 07:51:21 +0200 Subject: When a drag is finished with on Mac, then it should delete itself On other platforms then when a drag is finished then it cleans up by calling setMimeData(0) and deleteLater() on the drag object, this didn't happen before on the Mac which meant it did not delete the QDrag objects until the parent of them was deleted thus taking up memory. Task-number: QTBUG-11613 Reviewed-by: Prasanth --- src/gui/kernel/qcocoaview_mac.mm | 2 ++ src/gui/kernel/qdnd_mac.mm | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index eec9699..5c90e2e 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1587,6 +1587,8 @@ Qt::DropAction QDragManager::drag(QDrag *o) } } } + o->setMimeData(0); + o->deleteLater(); return performedAction; } diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm index 189d535..844f5e3 100644 --- a/src/gui/kernel/qdnd_mac.mm +++ b/src/gui/kernel/qdnd_mac.mm @@ -675,6 +675,8 @@ Qt::DropAction QDragManager::drag(QDrag *o) } if (atleastOne){ DisposeDrag(dragRef); + o->setMimeData(0); + o->deleteLater(); return action; } } @@ -682,6 +684,8 @@ Qt::DropAction QDragManager::drag(QDrag *o) DragActions ret = kDragActionNothing; GetDragDropAction(dragRef, &ret); DisposeDrag(dragRef); //cleanup + o->setMimeData(0); + o->deleteLater(); return qt_mac_dnd_map_mac_default_action(ret); } DisposeDrag(dragRef); //cleanup -- cgit v0.12