Guard XSPICE plot switching against circuit being removed already

This commit is contained in:
Holger Vogt 2020-04-19 11:45:11 +02:00
parent ae2d207344
commit bad2a4e467
2 changed files with 21 additions and 3 deletions

View File

@ -1111,6 +1111,11 @@ void plot_setcur(const char *name)
else if (cieq(name, "previous")) {
if (plot_cur->pl_next) {
plot_cur = plot_cur->pl_next;
#ifdef XSPICE
if (ft_curckt) {
EVTswitch_plot(ft_curckt->ci_ckt, plot_cur->pl_typename);
}
#endif
}
else {
fprintf(cp_err,
@ -1131,7 +1136,11 @@ void plot_setcur(const char *name)
}
if (prev_pl) { /* found */
plot_cur = prev_pl;
EVTswitch_plot(ft_curckt->ci_ckt, plot_cur->pl_typename);
#ifdef XSPICE
if (ft_curckt) {
EVTswitch_plot(ft_curckt->ci_ckt, plot_cur->pl_typename);
}
#endif
}
else { /* no next plot */
fprintf(cp_err,
@ -1156,7 +1165,14 @@ void plot_setcur(const char *name)
plot_cur->pl_ccom = cp_kwswitch(CT_VECTOR, pl->pl_ccom);
}
*/
EVTswitch_plot(ft_curckt->ci_ckt, name);
#ifdef XSPICE
/* XSPICE event data are linked to the current circuit. It must not be removed
when manipulating the data by any command.
*/
if (ft_curckt) {
EVTswitch_plot(ft_curckt->ci_ckt, name);
}
#endif
plot_cur = pl;
} /* end of function plot_setcur */

View File

@ -617,7 +617,9 @@ int EVTsetup_plot(CKTcircuit* ckt, char *plotname) {
}
/* If command 'setplot' is called, we switch to the corresponding event data.
Their pointers have been stored in the jobs structure.*/
Their pointers have been stored in the jobs structure. The circuit must
be still available!
*/
int EVTswitch_plot(CKTcircuit* ckt, const char* plottypename) {
int i;
bool found = FALSE;