summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmainwindowlayout_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qmainwindowlayout_mac.mm')
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index ee79f5a..d92168a 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -472,14 +472,20 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar)
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) {