From 54e947eed3d75d0fbae533e7e4cce8fe84aaf77c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 8 Apr 2015 00:43:35 -0400 Subject: Started work on ensuring things get cleaned up. Added a destroy() method to uiControl and implemented most of the work for Windows. --- new/stack.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'new/stack.c') diff --git a/new/stack.c b/new/stack.c index 433c6b5..45fcf54 100644 --- a/new/stack.c +++ b/new/stack.c @@ -17,6 +17,20 @@ struct stack { #define S(c) ((stack *) (c)) +static void stackDestroy(uiControl *c) +{ + stack *s = (stack *) c; + uintmax_t i; + + for (i = 0; i < S(c)->len; i++) + uiControlDestroy(s->controls[i]); + uiFree(s->controls); + uiFree(s->stretchy); + uiFree(s->width); + uiFree(s->height); + uiFree(s); +} + static uintptr_t stackHandle(uiControl *c) { return 0; @@ -163,6 +177,7 @@ uiControl *uiNewHorizontalStack(void) s = uiNew(stack); + s->control.destroy = stackDestroy; s->control.handle = stackHandle; s->control.setParent = stackSetParent; s->control.preferredSize = stackPreferredSize; -- cgit v1.2.3