diff options
author | Prasanth Ullattil <prasanth.ulattil@nokia.com> | 2009-10-12 11:44:14 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ulattil@nokia.com> | 2009-10-12 11:44:14 (GMT) |
commit | 0d231c32cc7670d356d486b13648cb5bd471ffef (patch) | |
tree | 0fdfec637b53b8090a75c5e5db3a72d06c274130 /src/gui/kernel | |
parent | 85bb10256b2745499f04c32a5ed738889606f6c3 (diff) | |
download | Qt-0d231c32cc7670d356d486b13648cb5bd471ffef.zip Qt-0d231c32cc7670d356d486b13648cb5bd471ffef.tar.gz Qt-0d231c32cc7670d356d486b13648cb5bd471ffef.tar.bz2 |
Fix a crash in cocoa when a QMessageBox is destroyed from dropEvent()
The gobal variable which stores the current mouse event can be updated
before dragImage() call(blocking) is finished. So make a local copy of
the information required by the QDragManager::drag().
Task-number: QTBUG-4814
Reviewed-by: MortenS
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 9eca29d..286eb31 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1277,29 +1277,29 @@ Qt::DropAction QDragManager::drag(QDrag *o) // convert the image to NSImage. NSImage *image = (NSImage *)qt_mac_create_nsimage(pix); [image retain]; - DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; + DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; // save supported actions - [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; - NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(), - dndParams->localPoint.y + pix.height() - hotspot.y()}; + [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; + NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(), + dndParams.localPoint.y + pix.height() - hotspot.y()}; NSSize mouseOffset = {0.0, 0.0}; NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - NSPoint windowPoint = [dndParams->theEvent locationInWindow]; + NSPoint windowPoint = [dndParams.theEvent locationInWindow]; dragPrivate()->executed_action = Qt::ActionMask; // do the drag - [dndParams->view retain]; - [dndParams->view dragImage:image + [dndParams.view retain]; + [dndParams.view dragImage:image at:imageLoc offset:mouseOffset - event:dndParams->theEvent + event:dndParams.theEvent pasteboard:pboard - source:dndParams->view + source:dndParams.view slideBack:YES]; - [dndParams->view release]; + [dndParams.view release]; [image release]; dragPrivate()->executed_action = Qt::IgnoreAction; object = 0; - Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction)); + Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams.performedAction)); // do post drag processing, if required. if(performedAction != Qt::IgnoreAction) { // check if the receiver points us to a file location. |