summaryrefslogtreecommitdiff
path: root/new/stack.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-08 00:43:35 -0400
committerPietro Gagliardi <[email protected]>2015-04-08 00:43:35 -0400
commit54e947eed3d75d0fbae533e7e4cce8fe84aaf77c (patch)
treed510e639dfdb00f7ae8d8ce9de90a9e54001f901 /new/stack.c
parent521829a0a66f62e9ed4256440a1ed34565e4d51f (diff)
Started work on ensuring things get cleaned up. Added a destroy() method to uiControl and implemented most of the work for Windows.
Diffstat (limited to 'new/stack.c')
-rw-r--r--new/stack.c15
1 files changed, 15 insertions, 0 deletions
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;