More destruction rules following code.
This commit is contained in:
parent
0af03e5410
commit
21a29a5468
2
TODO.md
2
TODO.md
|
@ -22,7 +22,7 @@
|
|||
- settle onDestroy/destroy naming
|
||||
- clean up Windows lifetiming code
|
||||
- forbid free(NULL) to check for bugs
|
||||
- figure out how to do the parent on destroy check for uiStack
|
||||
- figure out how to do the parent on destroy check for children of a uiStack without a parent in and of itself
|
||||
|
||||
ultimately:
|
||||
- make everything vtable-based
|
||||
|
|
|
@ -27,6 +27,8 @@ uiLogObjCClassAllocations
|
|||
- (void)uipDestroyMainControl
|
||||
{
|
||||
if (self->mainControl != NULL) {
|
||||
// we have to do this before we can destroy controls
|
||||
uiControlSetParent(p->mainControl, NULL);
|
||||
uiControlDestroy(self->mainControl);
|
||||
self->mainControl = NULL;
|
||||
}
|
||||
|
|
2
stack.c
2
stack.c
|
@ -33,6 +33,8 @@ static void stackDestroy(uiControl *c)
|
|||
stack *s = (stack *) c;
|
||||
uintmax_t i;
|
||||
|
||||
if (s->parent != NULL)
|
||||
complain("attempt to destroy a uiControl at %p while it still has a parent %p", c, s->parent);
|
||||
for (i = 0; i < s->len; i++)
|
||||
uiControlDestroy(s->controls[i].c);
|
||||
uiFree(s->controls);
|
||||
|
|
|
@ -146,6 +146,8 @@ static void parentDestroy(uiParent *pp)
|
|||
|
||||
// first, destroy the main control
|
||||
if (p->mainControl != NULL) {
|
||||
// we have to do this before we can destroy controls
|
||||
uiControlSetParent(p->mainControl, NULL);
|
||||
uiControlDestroy(p->mainControl);
|
||||
p->mainControl = NULL;
|
||||
}
|
||||
|
|
|
@ -235,6 +235,8 @@ static void parentDestroy(uiParent *pp)
|
|||
|
||||
// first destroy the main control, if any
|
||||
if (p->mainControl != NULL) {
|
||||
// we have to do this before we can destroy controls
|
||||
uiControlSetParent(p->mainControl, NULL);
|
||||
uiControlDestroy(p->mainControl);
|
||||
p->mainControl = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue