Browse Source

Fix a crash that happens after an iplot window is zoomed and closed

while active.
pre-master-46
Giles Atkinson 1 year ago
committed by Holger Vogt
parent
commit
d549b882df
  1. 11
      src/frontend/plotting/graf.c

11
src/frontend/plotting/graf.c

@ -81,7 +81,7 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */
const char *commandline, /* For xi_zoomdata() */ const char *commandline, /* For xi_zoomdata() */
int prevgraph) /* plot id, if started from a previous plot*/ int prevgraph) /* plot id, if started from a previous plot*/
{ {
GRAPH *graph;
GRAPH *graph, *pgraph;
wordlist *wl; wordlist *wl;
NG_IGNORE(nplots); NG_IGNORE(nplots);
@ -157,11 +157,14 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */
graph->plotname = tprintf("%s: %s", pname, plotname); graph->plotname = tprintf("%s: %s", pname, plotname);
/* restore background color from previous graph, e.g. for zooming, /* restore background color from previous graph, e.g. for zooming,
it will be used in NewViewport(graph) */ it will be used in NewViewport(graph) */
if (prevgraph > 0) { if (prevgraph > 0) {
graph->mgraphid = prevgraph;
pgraph = FindGraph(prevgraph);
if (pgraph)
graph->mgraphid = prevgraph;
else
prevgraph = graph->mgraphid = 0;
} }
else { else {
graph->mgraphid = 0; graph->mgraphid = 0;
@ -178,7 +181,7 @@ int gr_init(double *xlims, double *ylims, /* The size of the screen. */
/* restore data from previous graph, e.g. for zooming */ /* restore data from previous graph, e.g. for zooming */
if (prevgraph > 0) { if (prevgraph > 0) {
int i; int i;
GRAPH* pgraph = FindGraph(prevgraph);
/* transmit colors */ /* transmit colors */
for (i = 0; i < 25; i++) { for (i = 0; i < 25; i++) {
graph->colorarray[i] = pgraph->colorarray[i]; graph->colorarray[i] = pgraph->colorarray[i];

Loading…
Cancel
Save