From 2a947a933eadcc446dacf55e8a2c7cdb5fc8f9f6 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 4 Nov 2018 22:47:03 +0100 Subject: [PATCH] bug 253: Do not delete the scale vector of the current plot --- src/frontend/postcoms.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index 27d50b235..89ce73a5b 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -28,12 +28,27 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group static void killplot(struct plot *pl); static void DelPlotWindows(struct plot *pl); +/* check if the user want's to delete the scale vector of the current plot. + This should not happen, because then redrawing the graph crashes ngspice */ +static bool +check_cp(char* vecname) +{ + if (plot_cur && plot_cur->pl_scale && plot_cur->pl_scale->v_name && eq(plot_cur->pl_scale->v_name, vecname)) { + fprintf(cp_err, "\nWarning: Scale vector '%s' of current plot cannot be deleted!\n", vecname); + fprintf(cp_err, " Command 'unlet %s' is ignored.\n\n", vecname); + return TRUE; + } + else + return FALSE; +} void com_unlet(wordlist *wl) { while (wl) { - vec_remove(wl->wl_word); + /* don't delete the scale vector of the current plot */ + if (!check_cp(wl->wl_word)) + vec_remove(wl->wl_word); wl = wl->wl_next; } }