From 8a10f903368120e0b1b6e908bcfadcc5fabcd2ff Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 25 Apr 2015 18:33:36 -0400 Subject: [PATCH] Added a lifeline to keep my sanity about lifetimes. Not sure if this will stay or not... --- new/GNUmakefile | 1 + new/lifetimes.c | 11 +++++++++++ new/uipriv.h | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 new/lifetimes.c diff --git a/new/GNUmakefile b/new/GNUmakefile index aa01f372..bb3fd6a4 100644 --- a/new/GNUmakefile +++ b/new/GNUmakefile @@ -24,6 +24,7 @@ baseHFILES = \ baseCFILES = \ box.c \ + lifetimes.c \ $(osCFILES) baseMFILES = $(osMFILES) diff --git a/new/lifetimes.c b/new/lifetimes.c new file mode 100644 index 00000000..efeb1f34 --- /dev/null +++ b/new/lifetimes.c @@ -0,0 +1,11 @@ +// 25 april 2015 +#include "ui.h" +#include "uipriv.h" + +// called by uiParentDestroy() and any container control in its uiControlDestroy() +void properlyDestroyControl(uiControl *c) +{ + uiControlSetOSContainer(c, NULL); + uiControlSetHasParent(c, 0); + uiControlDestroy(c); +} diff --git a/new/uipriv.h b/new/uipriv.h index 4908ccaf..cc3d672a 100644 --- a/new/uipriv.h +++ b/new/uipriv.h @@ -9,3 +9,6 @@ extern void *uiRealloc(void *, size_t, const char *); extern void uiFree(void *); extern void complain(const char *, ...); + +// lifetimes.c +extern void properlyDestroyControl(uiControl *);