From 85ae0734718c19b7a46179358393f1b2b84e10d4 Mon Sep 17 00:00:00 2001 From: Jim Holmes Date: Sun, 12 Oct 2014 19:08:16 +0200 Subject: [PATCH] src/frontend/postcoms.c, bugfix, write/save an xspice `event' node In function EVTfindvec() XSPICE can create a `dvec' with a non NULL `v_scale' slot. This special scale with name "step" differs from the current plot `pl_scale' slot and triggered ancient buggy code here. --- src/frontend/postcoms.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index 99a957cfb..47016b3b1 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -477,11 +477,13 @@ com_write(wordlist *wl) for (vv = newplot.pl_dvecs; vv; vv = vv->v_next) if (vec_eq(vv, d->v_scale)) break; - /* We have to grab it... */ - vv = vec_copy(d->v_scale); - vv->v_next = newplot.pl_dvecs; - newplot.pl_dvecs = vv; - scalefound = TRUE; + if (!vv) { + /* We have to grab it... */ + vv = vec_copy(d->v_scale); + vv->v_next = newplot.pl_dvecs; + newplot.pl_dvecs = vv; + scalefound = TRUE; + } } } @@ -641,11 +643,13 @@ com_write_sparam(wordlist *wl) for (vv = newplot.pl_dvecs; vv; vv = vv->v_next) if (vec_eq(vv, d->v_scale)) break; - /* We have to grab it... */ - vv = vec_copy(d->v_scale); - vv->v_next = newplot.pl_dvecs; - newplot.pl_dvecs = vv; - scalefound = TRUE; + if (!vv) { + /* We have to grab it... */ + vv = vec_copy(d->v_scale); + vv->v_next = newplot.pl_dvecs; + newplot.pl_dvecs = vv; + scalefound = TRUE; + } } } if (!scalefound)