Fixed bin destruction on Mac OS X.
This commit is contained in:
parent
a15bb12ad1
commit
2c7bccb3a8
|
@ -19,6 +19,7 @@ static void destroy(void *data)
|
|||
while ([t->tabview numberOfTabViewItems] != 0)
|
||||
[t->tabview removeTabViewItem:[t->tabview tabViewItemAtIndex:0]];
|
||||
// then destroy all the bins, destroying children in the process
|
||||
// the above loop serves the purpose of binSetParent()
|
||||
[t->pages enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
|
||||
NSValue *v = (NSValue *) obj;
|
||||
uiContainer *p;
|
||||
|
@ -119,6 +120,7 @@ static void tabDeletePage(uiTab *tt, uintmax_t n)
|
|||
binSetMainControl(p, NULL);
|
||||
|
||||
// remove the bin from the tab view
|
||||
// this serves the purpose of binSetParent()
|
||||
i = [t->tabview tabViewItemAtIndex:n];
|
||||
[t->tabview removeTabViewItem:i];
|
||||
|
||||
|
|
|
@ -59,8 +59,10 @@ static void windowDestroy(uiControl *c)
|
|||
// first hide ourselves
|
||||
[w->window orderOut:w->window];
|
||||
// now destroy the bin
|
||||
// the bin has no parent, so we can just call uiControlDestroy()
|
||||
// we also don't have to worry about the NSWindow's reference to the content view; that'll be released too
|
||||
// we need to remove the bin from its parent; this is equivalent to calling binSetParent()
|
||||
// we do this by changing the content view to a dummy view
|
||||
// the window will release its reference on the bin now, then it will release its reference on the dummy view when the window itself is finally released
|
||||
[w->window setContentView:[[NSView alloc] initWithFrame:NSZeroRect]];
|
||||
uiControlDestroy(uiControl(w->bin));
|
||||
// now destroy the delegate
|
||||
[w->window setDelegate:nil];
|
||||
|
|
Loading…
Reference in New Issue