From 522af6576db6f1745ad67d1a896e8447e19a5cee Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 23 Mar 2012 12:53:54 +0100 Subject: Fixed a possible crash in Qt Cocoa Task-Number: QTBUG-24334 This patch is not dircetly from me but was posted on https://bugreports.qt-project.org/browse/QTBUG-24334. I'm definitely affected by it. Change-Id: Ieb23a7022417188b3885dcb5467affdef71c194f Reviewed-by: Andy Shaw Reviewed-by: Ivan Komissarov Reviewed-by: Andrew Semenenko Reviewed-by: Robin Burchell --- src/gui/kernel/qwidget_mac.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 399dad0..54a7084 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -236,10 +236,14 @@ static void qt_mac_destructView(OSViewRef view) { #ifdef QT_MAC_USE_COCOA NSWindow *window = [view window]; - if ([window contentView] == view) - [window setContentView:[[NSView alloc] initWithFrame:[view bounds]]]; - [view removeFromSuperview]; - [view release]; + if ([window contentView] == view) { + NSView* newView = [[NSView alloc] initWithFrame:[view bounds]]; + [window setContentView:newView]; + [newView release]; + } else { + [view removeFromSuperview]; + [view release]; + } #else HIViewRemoveFromSuperview(view); CFRelease(view); -- cgit v0.12