jne@goldhill.COM (07/13/89)
I apologize if this has already been posted. When destroying an application context, the code does the obvious stuff such as closing all the associated displays and freeing the application structure. It does not, however, unlink the structure from the list of all applications, causing you to run across garbage pretty quickly. Here's a fix, for lib/Xt/Display.c. Replace the function DestroyAppContext with the following. static void DestroyAppContext(app) XtAppContext app; { ProcessContext process = _XtGetProcessContext(); while (app->count-- > 0) XCloseDisplay(app->list[app->count]); if (app->list != NULL) XtFree((char *)app->list); _XtFreeConverterTable(app->converterTable); /* have to both make it not the default and unlink it -- jne */ if (process->defaultAppContext == app) process->defaultAppContext = NULL ; if (process->appContextList == app) { process->appContextList = app->next ; } else { XtAppContext nextapp ; for (nextapp = process->appContextList; nextapp != NULL ; nextapp = nextapp->next) { if (nextapp->next == app) { nextapp->next = app->next ; break ; } } } XtFree((char *)app); }