diff --git a/redo/types.c b/redo/types.c index ac0a0bdc..ee6df2ad 100644 --- a/redo/types.c +++ b/redo/types.c @@ -57,7 +57,21 @@ void *uiIsA(void *p, uintmax_t id, int fail) return NULL; } -// TODO free type info +void uninitTypes(void) +{ + struct typeinfo *ti; + + if (types == NULL) // never initialized; do nothing + return; + // the first entry is NULL; get rid of it directly + ptrArrayDelete(types, 0); + while (types->len != 0) { + ti = ptrArrayIndex(types, struct typeinfo *, 0); + ptrArrayDelete(types, 0); + uiFree(ti); + } + ptrArrayDestroy(types); +} uiTyped *newTyped(uintmax_t type) { diff --git a/redo/uipriv.h b/redo/uipriv.h index 0eddbec0..662e7f85 100644 --- a/redo/uipriv.h +++ b/redo/uipriv.h @@ -34,4 +34,5 @@ void ptrArrayDelete(struct ptrArray *, uintmax_t); extern int shouldQuit(void); // types.c +extern void uninitTypes(void); extern uiTyped *newTyped(uintmax_t type); diff --git a/redo/windows/init.c b/redo/windows/init.c index 21e9ce7d..b2fe102d 100644 --- a/redo/windows/init.c +++ b/redo/windows/init.c @@ -170,6 +170,7 @@ void uiUninit(void) // TODO delete default cursor // TODO delete default icon uninitResizes(); + uninitTypes(); uninitAlloc(); }