summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-01-25 12:17:21 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-01-25 12:24:54 (GMT)
commitc56ede1d6f5082cd10c310d473779cfea3363fe6 (patch)
tree5a7c131f888df4f704aeb68b39af71da79cc3a58 /src/gui/widgets
parent41bda2792993bc04faf33a61eda46f53210349f5 (diff)
downloadQt-c56ede1d6f5082cd10c310d473779cfea3363fe6.zip
Qt-c56ede1d6f5082cd10c310d473779cfea3363fe6.tar.gz
Qt-c56ede1d6f5082cd10c310d473779cfea3363fe6.tar.bz2
Crash when deleting QMainWindow with native toolbar on Cocoa.
The crash happens while processing a paint message received by the NSToolbar after the corresponding QToolbar has been destroyed. So while cleaning up the toolbar, the view needs to be detached from the custom toolbar item. Task-number: QTBUG-7305 Reviewed-by: Carlos Manuel Duclos Vergara
Diffstat (limited to 'src/gui/widgets')
-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) {