summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2013-11-28 14:42:56 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-29 08:49:06 +0100
commitd55db6dd535149adca77a5d5a1bb61823aee94b5 (patch)
treeb3f8921a176102a06e7839c1f74d3184758ae4ca
parentad684ff2a7d91a948ad9d2f3765dd08c78d81020 (diff)
downloadqtbase-d55db6dd535149adca77a5d5a1bb61823aee94b5.tar.gz
Cocoa: avoid a crash in QCocoaDrag
NSEvent needs to be copied. Reference: http://lists.apple.com/archives/cocoa-dev/2007/Dec/msg00678.html Task-number: QTBUG-33533 Change-Id: I73709545573e59aab6875a8c3dd903cb171e858f Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm8
2 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h
index 80259df600..6810a21944 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.h
+++ b/src/plugins/platforms/cocoa/qcocoadrag.h
@@ -55,6 +55,7 @@ class QCocoaDrag : public QPlatformDrag
{
public:
QCocoaDrag();
+ virtual ~QCocoaDrag();
virtual QMimeData *platformDropData();
virtual Qt::DropAction drag(QDrag *m_drag);
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index a37552d844..a22830f64e 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -53,9 +53,15 @@ QCocoaDrag::QCocoaDrag() :
m_lastView = 0;
}
+QCocoaDrag::~QCocoaDrag()
+{
+ [m_lastEvent release];
+}
+
void QCocoaDrag::setLastMouseEvent(NSEvent *event, NSView *view)
{
- m_lastEvent = event;
+ [m_lastEvent release];
+ m_lastEvent = [event copy];
m_lastView = view;
}