From 9ff20ad5f6556a974a668b395ad4b1abb6dc2050 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 3 May 2015 12:59:11 -0400 Subject: [PATCH] Implemented the bin OS parent check on OS X now that I know it actually IS meaningful. --- darwin/bin.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/darwin/bin.m b/darwin/bin.m index e8b7dd46..7344faa3 100644 --- a/darwin/bin.m +++ b/darwin/bin.m @@ -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);