summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2013-08-14 08:35:39 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-20 06:25:43 (GMT)
commit871c2fbc5192836cc2918a760aec4d4c680fd8c0 (patch)
tree06d8e47911a46f00bf21d9daf4c1c84ec20d4a48
parent23717f80cd0f2e6a63aaabc1f62a377d13f76540 (diff)
downloadQt-871c2fbc5192836cc2918a760aec4d4c680fd8c0.zip
Qt-871c2fbc5192836cc2918a760aec4d4c680fd8c0.tar.gz
Qt-871c2fbc5192836cc2918a760aec4d4c680fd8c0.tar.bz2
Only release when there is no lock on the object
When the widget was unregistered for drag and drop then it would call Release() on the dropTarget before doing anything else. If the widget itself did not have a handle then this was not a problem. However in the case of a widget with a handle then it would call Release() before the lock on the dropTarget was released which would cause it to crash. Therefore it is moved so that it is called after the lock is released to ensure it can be released correctly. Task-number: QTBUG-13237 Change-Id: Iaec3eb8be3a4ea988218012e973f69cbcdcc45de Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r--src/gui/kernel/qwidget_win.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 1e8b030..e39b3cf 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1796,10 +1796,10 @@ QOleDropTarget* QWidgetPrivate::registerOleDnd(QWidget *widget)
void QWidgetPrivate::unregisterOleDnd(QWidget *widget, QOleDropTarget *dropTarget)
{
- dropTarget->releaseQt();
- dropTarget->Release();
Q_ASSERT(widget->testAttribute(Qt::WA_WState_Created));
if (!widget->internalWinId()) {
+ dropTarget->releaseQt();
+ dropTarget->Release();
QWidget *nativeParent = widget->nativeParentWidget();
while (nativeParent) {
QWExtra *nativeExtra = nativeParent->d_func()->extra;
@@ -1828,6 +1828,8 @@ void QWidgetPrivate::unregisterOleDnd(QWidget *widget, QOleDropTarget *dropTarge
#ifndef Q_OS_WINCE
CoLockObjectExternal(dropTarget, false, true);
#endif
+ dropTarget->releaseQt();
+ dropTarget->Release();
RevokeDragDrop(widget->internalWinId());
}
}