src/gui/widgets/qmainwindowlayout_mac.mm
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 8 3f74d0d4af4c
--- a/src/gui/widgets/qmainwindowlayout_mac.mm	Fri Feb 19 23:40:16 2010 +0200
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm	Fri Mar 12 15:46:37 2010 +0200
@@ -472,14 +472,20 @@
 
 void QMainWindowLayout::cleanUpMacToolbarItems()
 {
-    for (int i = 0; i < toolbarItemsCopy.size(); ++i)
+#ifdef QT_MAC_USE_COCOA
+    QMacCocoaAutoReleasePool pool;
+#endif
+    for (int i = 0; i < toolbarItemsCopy.size(); ++i) {
+#ifdef QT_MAC_USE_COCOA
+        NSToolbarItem *item = static_cast<NSToolbarItem *>(toolbarItemsCopy.at(i));
+        [item setView:0];
+#endif
         CFRelease(toolbarItemsCopy.at(i));
+    }
     toolbarItemsCopy.clear();
     unifiedToolbarHash.clear();
 
 #ifdef QT_MAC_USE_COCOA
-    QMacCocoaAutoReleasePool pool;
-
     OSWindowRef window = qt_mac_window_for(layoutState.mainWindow);
     NSToolbar *macToolbar = [window toolbar];
     if (macToolbar) {