diff --git a/signal.hpp b/signal.hpp index d7d8c120..8aa19785 100644 --- a/signal.hpp +++ b/signal.hpp @@ -103,8 +103,11 @@ namespace util { /// Execute all callbacks, ignoring the return parameters. Does not combine results. void operator () (Args... tail) { - for (auto i = m_children.cbegin (); i != m_children.cend (); ++i) - (*i)(tail...); + for (auto i = m_children.cbegin (); i != m_children.cend (); ) { + // Increment before we execute so that the caller is able to deregister during execution. + auto current = i++; + (*current)(tail...); + } } }; }