summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorThierry Bastian <thierryb@filewave.com>2012-03-23 11:53:54 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-03-26 23:09:45 (GMT)
commit522af6576db6f1745ad67d1a896e8447e19a5cee (patch)
tree2519bcb8632061c4f83be2c2521ef86b24f78f86 /src/gui/kernel
parentf84651c70a8654ce6bd22dc159807e07bdf61b2e (diff)
downloadQt-522af6576db6f1745ad67d1a896e8447e19a5cee.zip
Qt-522af6576db6f1745ad67d1a896e8447e19a5cee.tar.gz
Qt-522af6576db6f1745ad67d1a896e8447e19a5cee.tar.bz2
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 <andy.shaw@digia.com> Reviewed-by: Ivan Komissarov <ABBAPOH@nextmail.ru> Reviewed-by: Andrew Semenenko Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwidget_mac.mm12
1 files 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);