Added bin destruction OS parent checks.

This commit is contained in:
Pietro Gagliardi 2015-04-30 17:49:38 -04:00
parent dad19a6318
commit 40dee5a693
3 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,7 @@ void binDestroy(uiControl *c)
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
// TODO find a way to move the parented check here // TODO find a way to move the parented check here
// 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)
// don't chain up to base here; we need to destroy children ourselves first // don't chain up to base here; we need to destroy children ourselves first
if (b->mainControl != NULL) { if (b->mainControl != NULL) {
uiControlSetParent(b->mainControl, NULL); uiControlSetParent(b->mainControl, NULL);

View File

@ -17,8 +17,13 @@ struct bin {
void binDestroy(uiControl *c) void binDestroy(uiControl *c)
{ {
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
GtkWidget *binWidget;
// TODO find a way to move the parented check here // TODO find a way to move the parented check here
// ensure clean removal by making sure the bin has no OS parent
binWidget = GTK_WIDGET(uiControlHandle(uiControl(b)));
if (gtk_widget_get_parent(binWidget) != NULL)
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 // don't chain up to base here; we need to destroy children ourselves first
if (b->mainControl != NULL) { if (b->mainControl != NULL) {
uiControlSetParent(b->mainControl, NULL); uiControlSetParent(b->mainControl, NULL);

View File

@ -14,8 +14,13 @@ struct bin {
void binDestroy(uiControl *c) void binDestroy(uiControl *c)
{ {
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
HWND hwnd;
// TODO find a way to move the parented check here // TODO find a way to move the parented check here
// ensure clean removal by making sure the bin has no OS parent
hwnd = (HWND) uiControlHandle(uiControl(b));
if (GetAncestor(hwnd, GA_PARENT) != NULL)
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 // don't chain up to base here; we need to destroy children ourselves first
if (b->mainControl != NULL) { if (b->mainControl != NULL) {
uiControlSetParent(b->mainControl, NULL); uiControlSetParent(b->mainControl, NULL);