Implemented the bin OS parent check on OS X now that I know it actually IS meaningful.

This commit is contained in:
Pietro Gagliardi 2015-05-03 12:59:11 -04:00
parent e8600450aa
commit 9ff20ad5f6
1 changed files with 8 additions and 1 deletions

View File

@ -14,8 +14,15 @@ struct bin {
void binDestroy(uiControl *c)
{
struct bin *b = (struct bin *) c;
NSView *v;
// we can't check for an OS parent here because what we're working with with bin isn't subviews but rather content views (at least I think... TODO)
// ensure clean removal by making sure the bin has no OS parent
// note that:
// - the superview of a NSWindow content view is the window frame
// - the superview of *the active NSTabView page* is the NSTabView itself (we don't have to worry about other pages because if there are pages, then at least one page will be active, so we will eventually get here)
v = (NSView *) uiControlHandle(uiControl(b));
if ([v superview] != nil)
complain("attempt to destroy bin %p while it has an OS parent", b);
// don't chain up to base here; we need to destroy children ourselves first
if (b->mainControl != NULL) {
uiControlSetParent(b->mainControl, NULL);