summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-11 02:55:51 -0400
committerPietro Gagliardi <[email protected]>2015-04-11 02:56:16 -0400
commit1ab2a819036d07eb70252712eabd4e9e4d653c59 (patch)
treefa291d55aed3b57530b6bedaec4d943a319b8d75
parent4afca8f2c2f8a797263d54651366f9f1fbc2c09c (diff)
Finished the Mac OS X destruction work.
-rw-r--r--new/window_darwin.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/new/window_darwin.m b/new/window_darwin.m
index 9b6949f..539b113 100644
--- a/new/window_darwin.m
+++ b/new/window_darwin.m
@@ -25,6 +25,14 @@ uiLogObjCClassAllocations
- (void)windowWillClose:(NSNotification *)note
{
[self.w setDelegate:nil]; // see http://stackoverflow.com/a/29523141/3408572
+
+ // when we reach this point, we need to ensure that all the window's children are destroyed (for OS parity)
+ // this may not happen under certain conditions
+ // I'm not sure if calling uiQuit() in the close handler causes whatever causes our window to release its content view during deallocation to race with uiQuit()'s stopping of the run loop but that's one symptom I've noticed
+ // so let's manually change the content view now
+ // we'll set it to a new stock view; this should be enough to set our real container's superview to nil, triggering the destruction
+ [self.w setContentView:[[NSView alloc] initWithFrame:NSZeroRect]];
+
uiFree(self.uiw);
[self release];
}