Reorder signal exec traversal to allow deletions
This commit is contained in:
parent
955b97c73e
commit
78427bc45a
@ -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...);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user