plug memory leak in x11.c
try to obey the Xt toolkit protocol when closing widgets and application
This commit is contained in:
parent
cb42989204
commit
6c01089be1
|
|
@ -419,7 +419,8 @@ int DevSwitch(char *devname)
|
|||
|
||||
} else {
|
||||
|
||||
dispdev->Close();
|
||||
if (dispdev)
|
||||
dispdev->Close();
|
||||
dispdev = lastdev;
|
||||
lastdev = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
#include "ftehelp.h"
|
||||
#include "ngspice/hlpdefs.h"
|
||||
#include "misccoms.h"
|
||||
#include "postcoms.h"
|
||||
#include "circuits.h"
|
||||
#include "variable.h"
|
||||
#include "plotting/graf.h"
|
||||
#include "display.h"
|
||||
|
||||
#ifdef HAVE_GNUREADLINE
|
||||
#include <readline/readline.h>
|
||||
|
|
@ -51,6 +53,12 @@ com_quit(wordlist *wl)
|
|||
|
||||
/* start to clean up the mess */
|
||||
|
||||
{
|
||||
wordlist *t = wl_cons(copy("all"), NULL);
|
||||
com_destroy(t);
|
||||
wl_free(t);
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_CODE
|
||||
/* Destroy CKT when quit. Add by Gong Ding, gdiso@ustc.edu */
|
||||
if (!ft_nutmeg) {
|
||||
|
|
@ -61,6 +69,9 @@ com_quit(wordlist *wl)
|
|||
}
|
||||
#endif
|
||||
|
||||
DevSwitch(NULL);
|
||||
DevSwitch(NULL);
|
||||
|
||||
/* then go away */
|
||||
byemesg();
|
||||
exit(exitcode);
|
||||
|
|
|
|||
|
|
@ -507,7 +507,16 @@ X11_NewViewport(GRAPH *graph)
|
|||
int
|
||||
X11_Close(void)
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
// don't, this has never been mapped, there is no window ...
|
||||
// XtUnmapWidget(toplevel);
|
||||
XtDestroyWidget(toplevel);
|
||||
|
||||
XtAppContext app = XtDisplayToApplicationContext(display);
|
||||
XtDestroyApplicationContext(app);
|
||||
|
||||
// don't, XtDestroyApplicationContext(app) seems to have done that
|
||||
// XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -909,7 +918,10 @@ RemoveWindow(GRAPH *graph)
|
|||
/* Iplots are done asynchronously */
|
||||
DEVDEP(graph).isopen = 0;
|
||||
/* MW. Not sure but DestroyGraph might free() to much - try Xt...() first */
|
||||
XtUnmapWidget(DEVDEP(graph).shell);
|
||||
XtDestroyWidget(DEVDEP(graph).shell);
|
||||
XFreeFont(display, DEVDEP(graph).font);
|
||||
XFreeGC(display, DEVDEP(graph).gc);
|
||||
}
|
||||
|
||||
if (graph == currentgraph)
|
||||
|
|
|
|||
Loading…
Reference in New Issue