Fixed destruction order in box.c.

This commit is contained in:
Pietro Gagliardi 2015-04-26 23:41:18 -04:00
parent 45ec5f4125
commit 3907efcc2f
1 changed files with 4 additions and 1 deletions

View File

@ -31,12 +31,15 @@ static void boxDestroy(uiControl *c)
box *b = (box *) c;
uintmax_t i;
(*(b->baseDestroy))(c);
// TODO find a way to move the parented check here
// don't chain up to base here; we need to destroy children ourselves first
for (i = 0; i < b->len; i++) {
uiControlSetParent(b->controls[i].c, NULL);
uiControlDestroy(b->controls[i].c);
}
uiFree(b->controls);
// NOW we can chain up to base
(*(b->baseDestroy))(c);
uiFree(b);
}