From c89c2ef286e0628d844c0da39b0e081ca5df1866 Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Wed, 16 Jul 2014 17:19:17 -0700 Subject: [PATCH] Prevent multiple calls during construction. --- src/autowiring/AutoPacket.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index 3b877d6f4..c2e70189d 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -175,10 +175,16 @@ void AutoPacket::Initialize(void) { decoration.second.Reset(); } - // Call all subscribers with no required or optional arguments: + // Find all subscribers with no required or optional arguments: + std::list callCounters; for (auto& satCounter : m_satCounters) if (satCounter) - satCounter.CallAutoFilter(*this); + callCounters.push_back(&satCounter); + + // Call all subscribers with no required or optional arguments: + // NOTE: This may result in decorations that cause other subscribers to be called. + for (auto* call : callCounters) + call->CallAutoFilter(*this); // Initial satisfaction of the AutoPacket: UpdateSatisfaction(typeid(AutoPacket));