summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNils Jeisecke <jeisecke@saltation.de>2010-01-13 10:14:42 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-01-19 16:26:03 (GMT)
commitc5809ade611d93c165dbde8c6ee618da73b0ad48 (patch)
treeffb7ae148a80afd313e37a901c802ba619104325 /src
parent83a97dd0f2473a5c9cc1b6b0eba93de657d66ed4 (diff)
downloadQt-c5809ade611d93c165dbde8c6ee618da73b0ad48.zip
Qt-c5809ade611d93c165dbde8c6ee618da73b0ad48.tar.gz
Qt-c5809ade611d93c165dbde8c6ee618da73b0ad48.tar.bz2
Memory leak in native Toolbar cleanup in Cocoa
The QCocoaToolBarDelegate is not released when destroying the QMainWindowLayout. Task-number: QTBUG-7307 Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index e41c2be..ee79f5a 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -476,6 +476,17 @@ void QMainWindowLayout::cleanUpMacToolbarItems()
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) {
+ [[macToolbar delegate] release];
+ [macToolbar setDelegate:nil];
+ }
+#endif
}
void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const