hotfix CKT_BASE::_attribs destruction order - gnucap.git - Gnu Circuit Analysis Package

index : gnucap.git
Gnu Circuit Analysis Package
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix Salfelder <felix@salfelder.org>2024年02月05日 00:00:00 +0000
committerFelix Salfelder <felix@salfelder.org>2024年02月05日 00:00:00 +0000
commit6be32b783d068e7a8f87ebc29ec4325e92bee43d (patch)
tree24e7b07adbedd26fffb1f04813cec1b56fd68d36
parent83d93304fa7642ba17973d923ef7c3922cfd2800 (diff)
downloadgnucap-6be32b783d068e7a8f87ebc29ec4325e92bee43d.tar.gz
hotfix CKT_BASE::_attribs destruction order
Diffstat
-rw-r--r--include/e_base.h 8
-rw-r--r--include/patchlev.h 2
-rw-r--r--include/u_attrib.h 2
-rw-r--r--lib/e_base.cc 9
-rw-r--r--lib/e_card.cc 5
-rw-r--r--main/main.cc 6
6 files changed, 19 insertions, 13 deletions
diff --git a/include/e_base.h b/include/e_base.h
index 5af444ed..7fb68005 100644
--- a/include/e_base.h
+++ b/include/e_base.h
@@ -41,11 +41,11 @@ private:
public:
static SIM_DATA* _sim;
static PROBE_LISTS* _probe_lists;
-protected:
- static INDIRECT<ATTRIB_LIST_p> _attribs;
+//protected: // TODO
+ static INDIRECT<ATTRIB_LIST_p>* _attribs;
public:
- ATTRIB_LIST_p& attributes(const void* x) {return _attribs[x];}
- const ATTRIB_LIST_p& attributes(const void* x)const {return _attribs.at(x);}
+ ATTRIB_LIST_p& attributes(const void* x) { assert(_attribs); return (*_attribs)[x];}
+ const ATTRIB_LIST_p& attributes(const void* x)const { assert(_attribs); return _attribs->at(x);}
//--------------------------------------------------------------------
protected: // create and destroy
explicit CKT_BASE() :_probes(0), _label() {}
diff --git a/include/patchlev.h b/include/patchlev.h
index 7e216d31..81c6db9e 100644
--- a/include/patchlev.h
+++ b/include/patchlev.h
@@ -1 +1 @@
-#define PATCHLEVEL "snapshot 2024年01月30日"
+#define PATCHLEVEL "hotfix 2024年02月05日"
diff --git a/include/u_attrib.h b/include/u_attrib.h
index c22ad99e..83005aec 100644
--- a/include/u_attrib.h
+++ b/include/u_attrib.h
@@ -45,7 +45,7 @@ public:
}
}
- ~ATTRIB_LIST() {
+ ~ATTRIB_LIST() { itested();
if (_up) {
if (_up->dec_ref_count()==0) {
delete _up;
diff --git a/lib/e_base.cc b/lib/e_base.cc
index 13a7a783..2b9310df 100644
--- a/lib/e_base.cc
+++ b/lib/e_base.cc
@@ -36,7 +36,7 @@ static char fix_case(char c)
double CKT_BASE::tr_probe_num(const std::string&)const {return NOT_VALID;}
XPROBE CKT_BASE::ac_probe_ext(const std::string&)const {return XPROBE(NOT_VALID, mtNONE);}
/*--------------------------------------------------------------------------*/
-INDIRECT<ATTRIB_LIST_p> CKT_BASE::_attribs;
+INDIRECT<ATTRIB_LIST_p>* CKT_BASE::_attribs;
SIM_DATA* CKT_BASE::_sim = NULL;
PROBE_LISTS* CKT_BASE::_probe_lists = NULL;
/*--------------------------------------------------------------------------*/
@@ -52,11 +52,12 @@ CKT_BASE::~CKT_BASE()
trace1("", _probes);
assert(_probes==0);
- if (_attribs.count(this) > 0) {untested();
- _attribs.erase(this, this);
+ if(!_attribs){ itested();
+ }else if (_attribs->count(this) > 0) {
+ _attribs->erase(this, this);
}else{
}
- assert(_attribs.count(this)==0);
+ assert(!_attribs || _attribs->count(this)==0);
}
/*--------------------------------------------------------------------------*/
const std::string CKT_BASE::long_label()const
diff --git a/lib/e_card.cc b/lib/e_card.cc
index c196299c..d9e8b7fb 100644
--- a/lib/e_card.cc
+++ b/lib/e_card.cc
@@ -51,13 +51,14 @@ CARD::CARD(const CARD& p)
/*--------------------------------------------------------------------------*/
CARD::~CARD()
{
- purge();
+ // purge();
delete _subckt;
}
/*--------------------------------------------------------------------------*/
void CARD::purge()
{
- _attribs.erase(reinterpret_cast<bool*>(this)-net_nodes(), reinterpret_cast<bool*>(this)+param_count());
+ assert(_attribs);
+ _attribs->erase(reinterpret_cast<bool*>(this)-net_nodes(), reinterpret_cast<bool*>(this)+param_count());
CKT_BASE::purge();
}
/*--------------------------------------------------------------------------*/
diff --git a/main/main.cc b/main/main.cc
index b28c31e0..117aedd1 100644
--- a/main/main.cc
+++ b/main/main.cc
@@ -34,6 +34,7 @@
#include "c_comand.h"
#include "declare.h" /* plclose */
/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
struct JMP_BUF{
sigjmp_buf p;
} env;
@@ -97,7 +98,7 @@ static void read_startup_files(void)
}else{untested();
// already have a language specified in a startup file
}
- if (OPT::language) { untested();
+ if (OPT::language) {
OPT::case_insensitive = OPT::language->case_insensitive();
OPT::units = OPT::language->units();
}else{ untested();
@@ -243,6 +244,7 @@ int main(int argc, const char *argv[])
prepare_env();
CKT_BASE::_sim = new SIM_DATA;
CKT_BASE::_probe_lists = new PROBE_LISTS;
+ CKT_BASE::_attribs = new INDIRECT<ATTRIB_LIST_p>;
try {
{
SET_RUN_MODE xx(rBATCH);
@@ -308,6 +310,8 @@ int main(int argc, const char *argv[])
CKT_BASE::_probe_lists = NULL;
delete CKT_BASE::_sim;
CKT_BASE::_sim = NULL;
+ delete CKT_BASE::_attribs;
+ CKT_BASE::_attribs = NULL;
return 0;
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年11月25日 21:41:57 +0000

AltStyle によって変換されたページ (->オリジナル) /