Finished the Mac OS X destruction work.

This commit is contained in:
Pietro Gagliardi 2015-04-11 02:55:51 -04:00
parent ebb77919f9
commit 9ea77087b2
1 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,14 @@ uiLogObjCClassAllocations
- (void)windowWillClose:(NSNotification *)note - (void)windowWillClose:(NSNotification *)note
{ {
[self.w setDelegate:nil]; // see http://stackoverflow.com/a/29523141/3408572 [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); uiFree(self.uiw);
[self release]; [self release];
} }