diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-09-09 04:36:43 -0400 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-09-09 04:36:43 -0400 |
commit | 53a24b01ab93a35ccd6acc0ac9776b1a036b1d0e (patch) | |
tree | aaba44a6e3e3574c9a59f3bc780aa8cf97c1e0b7 /src/sim/probe/probe.cc | |
parent | b0e4de667a7d0d51ac0667ce1e48f13b2cb17716 (diff) | |
download | gem5-53a24b01ab93a35ccd6acc0ac9776b1a036b1d0e.tar.xz |
sim: Automatically unregister probe listeners
The ProbeListener base class automatically registers itself with a
probe manager. Currently, the class does not unregister a itself when
it is destroyed, which makes removing probes listeners somewhat
cumbersome. This patch adds an automatic call to
manager->removeListener in the ProbeListener destructor, which solves
the problem.
Diffstat (limited to 'src/sim/probe/probe.cc')
-rw-r--r-- | src/sim/probe/probe.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sim/probe/probe.cc b/src/sim/probe/probe.cc index 6f1a3d535..600d9dcc4 100644 --- a/src/sim/probe/probe.cc +++ b/src/sim/probe/probe.cc @@ -62,11 +62,17 @@ ProbeListenerObject::~ProbeListenerObject() listeners.clear(); } -ProbeListener::ProbeListener(ProbeManager *manager, const std::string &name) +ProbeListener::ProbeListener(ProbeManager *_manager, const std::string &_name) + : manager(_manager), name(_name) { manager->addListener(name, *this); } +ProbeListener::~ProbeListener() +{ + manager->removeListener(name, *this); +} + ProbeListenerObject* ProbeListenerObjectParams::create() { |