--- qcocoasharedwindowmethods_mac_p.h.old	2010-12-17 14:53:11.000000000 +0100
+++ qcocoasharedwindowmethods_mac_p.h	2010-12-21 06:15:06.000000000 +0100
@@ -57,6 +57,7 @@
 QT_BEGIN_NAMESPACE
 extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
+extern void cacheEvent(NSEvent *);
 QT_END_NAMESPACE
 
 - (BOOL)canBecomeKeyWindow
@@ -155,7 +156,7 @@
         case NSRightMouseDragged:
         case NSOtherMouseDragged:
             [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->view = view;
-            [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = event;
+			cacheEvent(event);
             handled = qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, mouseButton);
             break;
         default:


--- qcocoaview_mac_p.h.old	2010-12-17 15:00:24.000000000 +0100
+++ qcocoaview_mac_p.h	2010-12-17 15:01:45.000000000 +0100
@@ -70,6 +70,7 @@
     NSPoint localPoint;
     NSDragOperation performedAction;
     NSPoint activeDragEnterPos;
+	static bool initalized;
 };
 
 QT_END_NAMESPACE

--- qcocoaview_mac.mm.old	2010-12-17 14:57:07.000000000 +0100
+++ qcocoaview_mac.mm	2010-12-21 06:31:27.000000000 +0100
@@ -77,6 +77,7 @@
 QT_BEGIN_NAMESPACE
 
 Q_GLOBAL_STATIC(DnDParams, qMacDnDParams);
+bool DnDParams::initalized = false;
 
 extern void qt_mac_update_cursor_at_global_pos(const QPoint &globalPos); // qcursor_mac.mm
 extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp
@@ -85,6 +86,14 @@
 extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm
 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
 
+void cacheEvent(NSEvent *event)
+{
+	if ([QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent)
+		[[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent release];
+	[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = event;
+	[event retain];
+}
+
 Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
 {
     if (buttonNum == 0)
@@ -761,21 +770,21 @@
 - (void)mouseDragged:(NSEvent *)theEvent
 {
     qMacDnDParams()->view = self;
-    qMacDnDParams()->theEvent = theEvent;
+    cacheEvent(theEvent);
     qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
 }
 
 - (void)rightMouseDragged:(NSEvent *)theEvent
 {
     qMacDnDParams()->view = self;
-    qMacDnDParams()->theEvent = theEvent;
+	cacheEvent(theEvent);
     qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
 }
 
 - (void)otherMouseDragged:(NSEvent *)theEvent
 {
     qMacDnDParams()->view = self;
-    qMacDnDParams()->theEvent = theEvent;
+	cacheEvent(theEvent);
     qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
 }
 
@@ -1074,7 +1083,13 @@
 
 + (DnDParams*)currentMouseEvent
 {
-    return qMacDnDParams();
+    DnDParams *params = qMacDnDParams();
+	if (!DnDParams::initalized) {
+		params->view = 0;
+		params->theEvent = 0;
+		DnDParams::initalized = true;
+	}
+	return params;
 }
 
 - (void)keyDown:(NSEvent *)theEvent
@@ -1458,6 +1473,7 @@
     dragPrivate()->executed_action = Qt::ActionMask;
     // do the drag
     [dndParams.view retain];
+	[dndParams.theEvent retain];
     [dndParams.view dragImage:image
                             at:imageLoc
                         offset:mouseOffset
@@ -1468,6 +1484,7 @@
     // reset the implicit grab widget when drag ends because we will not
     // receive the mouse release event when DND is active.
     qt_button_down = 0;
+	[dndParams.theEvent release];
     [dndParams.view release];
     [image release];
     dragPrivate()->executed_action = Qt::IgnoreAction;

--- qt_cocoa_helpers_mac.mm.old	2010-12-17 15:03:09.000000000 +0100
+++ qt_cocoa_helpers_mac.mm	2010-12-21 06:22:01.000000000 +0100
@@ -89,6 +89,7 @@
 #include <private/qwidget_p.h>
 
 QT_BEGIN_NAMESPACE
+extern void cacheEvent(NSEvent *);
 
 Q_GLOBAL_STATIC(QMacWindowFader, macwindowFader);
 
@@ -951,7 +952,7 @@
         break;
     case QEvent::MouseButtonPress:
         [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->view = theView;
-        [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = theEvent;
+		cacheEvent(theEvent);
 #ifndef QT_NAMESPACE
         Q_ASSERT(clickCount > 0);
 #endif
