summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-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);