diff options
author | Gabe Black <gabeblack@google.com> | 2018-10-05 15:31:50 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-16 00:56:25 +0000 |
commit | 834846f80259522612d966657d68db3fb10ea90c (patch) | |
tree | 0f6f998ec2fdce2832cff43f766b223728ff6e3b /src | |
parent | f4a671e1eb534b9cf3e33af581adc364c577c57b (diff) | |
download | gem5-834846f80259522612d966657d68db3fb10ea90c.tar.xz |
systemc: Detach child events in the Object destructor.
This way they don't try to detach themselves from a parent object which
no longer exists.
Change-Id: Id4a3f3b2241cf8c67cae9b983bd4c1acbef083e3
Reviewed-on: https://gem5-review.googlesource.com/c/13301
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/systemc/core/event.cc | 10 | ||||
-rw-r--r-- | src/systemc/core/event.hh | 2 | ||||
-rw-r--r-- | src/systemc/core/object.cc | 3 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc index aa4a71315..120b51476 100644 --- a/src/systemc/core/event.cc +++ b/src/systemc/core/event.cc @@ -191,6 +191,16 @@ Event::triggered() const return _triggeredStamp == scheduler.changeStamp(); } +void +Event::clearParent() +{ + if (!parent) + return; + Object::getFromScObject(parent)->delChildEvent(sc_event()); + parent = nullptr; + topLevelEvents.emplace(topLevelEvents.end(), sc_event()); +} + Events topLevelEvents; Events allEvents; diff --git a/src/systemc/core/event.hh b/src/systemc/core/event.hh index 2d620c91b..532d98343 100644 --- a/src/systemc/core/event.hh +++ b/src/systemc/core/event.hh @@ -138,6 +138,8 @@ class Event } } + void clearParent(); + private: sc_core::sc_event *_sc_event; diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc index 91e3cb36a..781e6d6d1 100644 --- a/src/systemc/core/object.cc +++ b/src/systemc/core/object.cc @@ -145,6 +145,9 @@ Object::~Object() } children.clear(); + for (auto event: events) + Event::getFromScEvent(event)->clearParent(); + if (parent) popObject(&parent->_gem5_object->children, _name); else |