Fix a crash that happens after an iplot window is zoomed and closed
while active.
This commit is contained in:
parent
8eea1f0b41
commit
d549b882df
|
|
@ -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) {
|
||||||
|
pgraph = FindGraph(prevgraph);
|
||||||
|
if (pgraph)
|
||||||
graph->mgraphid = prevgraph;
|
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…
Reference in New Issue