Added deallocation of type information to types.c. We are finally back to NOT crashing when quitting!!
This commit is contained in:
parent
a892e6b339
commit
c08cad8a7e
16
redo/types.c
16
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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -170,6 +170,7 @@ void uiUninit(void)
|
|||
// TODO delete default cursor
|
||||
// TODO delete default icon
|
||||
uninitResizes();
|
||||
uninitTypes();
|
||||
uninitAlloc();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue