Browse Source

frontend/breakp.c, bug fix, "#306 Deleting breakpoint causes Internal Error in status"

The "delete" command destroyed the whole list of stored breakpoints
  instead of just the specified one.

Thanks to "jpcgt", who reported this in
  "#306 Deleting breakpoint causes Internal Error in status"
  http://sourceforge.net/p/ngspice/bugs/306/
pre-master-46
rlar 11 years ago
parent
commit
8be0829b9b
  1. 28
      src/frontend/breakp.c
  2. 1
      src/include/ngspice/fteext.h

28
src/frontend/breakp.c

@ -296,6 +296,19 @@ com_sttus(wordlist *wl)
* function settrace() in breakp2.c
*/
void
dbfree1(struct dbcomm *dd)
{
tfree(dd->db_nodename1);
tfree(dd->db_nodename2);
if (dd->db_also) {
dbfree(dd->db_also);
dd->db_also = NULL;
}
tfree(dd);
}
void
dbfree(struct dbcomm *db)
{
@ -303,13 +316,7 @@ dbfree(struct dbcomm *db)
for (dd = db; dd; dd = dn) {
dn = dd->db_next;
tfree(dd->db_nodename1);
tfree(dd->db_nodename2);
if (dd->db_also) {
dbfree(dd->db_also);
dd->db_also = NULL;
}
tfree(dd);
dbfree1(dd);
}
}
@ -324,10 +331,7 @@ com_delete(wordlist *wl)
struct dbcomm *d, *dt;
if (wl && eq(wl->wl_word, "all")) {
for (dt = dbs; dt; dt = d) {
d = dt->db_next;
dbfree(dt);
}
dbfree(dbs);
ft_curckt->ci_dbs = dbs = NULL;
return;
} else if (!wl) {
@ -362,7 +366,7 @@ com_delete(wordlist *wl)
dt->db_next = d->db_next;
else
ft_curckt->ci_dbs = dbs = d->db_next;
dbfree(d);
dbfree1(d);
(void) sprintf(buf, "%d", i);
cp_remkword(CT_DBNUMS, buf);
break;

1
src/include/ngspice/fteext.h

@ -30,6 +30,7 @@ extern void ft_checkkids(void);
extern bool ft_bpcheck(struct plot *runplot, int iteration);
extern void dbfree(struct dbcomm *db);
extern void dbfree1(struct dbcomm *db);
/* breakp2.c */

Loading…
Cancel
Save