diff --git a/ChangeLog b/ChangeLog index 785d2345c..b089b2b49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-04-09 Robert Larice + * src/frontend/plotting/x11.c : + bugfix, segfault when closing a plot window + fix the fix from 2011-02-11 + currentgraph is a dynamical scoped variable + in response to + http://sourceforge.net/tracker/?func=detail&atid=423915&aid=3263437&group_id=38962 + FIXME, need to be fixed for ms-windows as well + 2011-04-09 Robert Larice * src/spicelib/analysis/cktsens.c : bugfix, fix sensitvity calculation (for the dc-2+.cir testcase) diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 85ffe8517..f96986a04 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -854,13 +854,18 @@ hardcopy(Widget w, caddr_t client_data, caddr_t call_data) lasthardcopy = (GRAPH *) client_data; - if (currentgraph->devdep) { - X11devdep tempdevdep = DEVDEP(currentgraph); + /* FIXME #1: this should print currentgraph with + * currentgraph dynamically bound to client_data + * FIXME #2: the !currentgraphs case, + * don't bother do call com_hardcopy + */ + + if (currentgraph) { + void *devdep = currentgraph->devdep; com_hardcopy(NULL); - DEVDEP(currentgraph) = tempdevdep; + currentgraph->devdep = devdep; } else { com_hardcopy(NULL); - currentgraph->devdep = NULL; } } @@ -887,7 +892,7 @@ RemoveWindow(GRAPH *graph) /* MW. Not sure but DestroyGraph might free() to much - try Xt...() first */ XtDestroyWidget(DEVDEP(graph).shell); if (graph == currentgraph) - currentgraph = FindGraph(graph->graphid - 1); + currentgraph = NULL; DestroyGraph(graph->graphid); } @@ -928,7 +933,12 @@ redraw(Widget w, caddr_t client_data, caddr_t call_data) rects, n, Unsorted); noclear = True; - gr_redraw(graph); + { + GRAPH *tmp = currentgraph; + currentgraph = graph; + gr_redraw(graph); + currentgraph = tmp; + } noclear = False; XSetClipMask(display, DEVDEP(graph).gc, None); @@ -954,7 +964,12 @@ resize(Widget w, caddr_t client_data, caddr_t call_data) XClearWindow(display, DEVDEP(graph).window); graph->absolute.width = w->core.width; graph->absolute.height = w->core.height; - gr_resize(graph); + { + GRAPH *tmp = currentgraph; + currentgraph = graph; + gr_resize(graph); + currentgraph = tmp; + } }