From d215ecd857be9eedee03703153ef2509c01b4811 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Sat, 14 Nov 2009 00:23:41 +0100 Subject: Designer crashes in Mac Cocoa port. When we reparent a widget, it has to be removed from the old view before it is added to the new one. Otherwise this can cause the old view to have an invalid first responder, causing crash. Task-number: QTBUG-5327 Reviewed-by: Denis --- src/gui/kernel/qwidget_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 75f9a59..71f0077 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2673,7 +2673,10 @@ void QWidgetPrivate::transferChildren() // site disabled until it is part of the new hierarchy. bool oldRegistered = w->testAttribute(Qt::WA_DropSiteRegistered); w->setAttribute(Qt::WA_DropSiteRegistered, false); + [qt_mac_nativeview_for(w) retain]; + [qt_mac_nativeview_for(w) removeFromSuperview]; [qt_mac_nativeview_for(q) addSubview:qt_mac_nativeview_for(w)]; + [qt_mac_nativeview_for(w) release]; w->setAttribute(Qt::WA_DropSiteRegistered, oldRegistered); #endif } -- cgit v0.12