fix for Trigger's whose termination leads to deleting other Trigger's

This commit is contained in:
Vern Paxson 2023-12-08 14:48:28 -05:00 committed by Arne Welzel
parent ead4b681aa
commit 8e0a62bfec
2 changed files with 5 additions and 8 deletions

View file

@ -58,13 +58,10 @@ void Registry::Modified(Modifiable* m) {
} }
void Registry::Terminate() { void Registry::Terminate() {
std::set<Receiver*> receivers; while ( ! registrations.empty() ) {
const auto& it = registrations.begin();
for ( auto& r : registrations ) it->second->Terminate();
receivers.emplace(r.second); }
for ( auto& r : receivers )
r->Terminate();
} }
Modifiable::~Modifiable() { Modifiable::~Modifiable() {

View file

@ -69,7 +69,7 @@ public:
~Trigger() override; ~Trigger() override;
// Evaluates the condition. If true, executes the body and deletes // Evaluates the condition. If true, executes the body and deletes
// the object deleted. // the object.
// //
// Returns the state of condition. // Returns the state of condition.
bool Eval(); bool Eval();