fix a segfault, when invoking `destroy' while running in batch mode on unix

This commit is contained in:
rlar 2011-06-02 13:28:36 +00:00
parent 545e9004e9
commit 2d1e44787b
3 changed files with 14 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2011-06-02 Robert Larice
* src/frontend/plotting/graf.c ,
* src/frontend/plotting/x11.c :
fix a segfault, when invoking `destroy' while running in batch mode on unix
2011-06-02 Robert Larice
* src/frontend/evaluate.c :
fix a segfault, incorrect invocation of free()

View File

@ -132,7 +132,6 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
graph->data.ymin = ylims[0];
graph->data.ymax = ylims[1];
/* get title into plot window */
#ifdef HAS_WINDOWS
if (!pname)
pname = "(unknown)";
if (!plotname)
@ -140,7 +139,6 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
comb_title = TMALLOC(char, strlen(plotname) + strlen(pname) + 3);
sprintf(comb_title, "%s: %s", pname, plotname);
graph->plotname = comb_title;
#endif
/* note: have enum here or some better convention */
if (NewViewport(graph) == 1) {
@ -187,15 +185,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
graph->grid.ylabel = "imag";
}
}
#ifndef HAS_WINDOWS
if (!pname)
pname = "(unknown)";
if (!plotname)
plotname = "(unknown)";
comb_title = TMALLOC(char, strlen(plotname) + strlen(pname) + 3);
sprintf(comb_title, "%s: %s", pname, plotname);
graph->plotname = comb_title;
#endif
gr_resize_internal(graph);
gr_redrawgrid(graph);

View File

@ -907,12 +907,16 @@ killwin(Widget w, XtPointer client_data, XtPointer call_data)
void
RemoveWindow(GRAPH *graph)
{
/* Iplots are done asynchronously */
DEVDEP(graph).isopen = 0;
/* MW. Not sure but DestroyGraph might free() to much - try Xt...() first */
XtDestroyWidget(DEVDEP(graph).shell);
if(graph->devdep) {
/* Iplots are done asynchronously */
DEVDEP(graph).isopen = 0;
/* MW. Not sure but DestroyGraph might free() to much - try Xt...() first */
XtDestroyWidget(DEVDEP(graph).shell);
}
if (graph == currentgraph)
currentgraph = NULL;
DestroyGraph(graph->graphid);
}