Fix wrong increment of deleted iterator.

This fixes the invalid access spotted by valgrind.
This commit is contained in:
King_DuckZ 2016-10-31 19:51:52 +01:00
parent 09b41f6d0c
commit 09299595fe

View file

@ -140,8 +140,9 @@ namespace cloonel {
template <typename T> template <typename T>
void ObserversManager<T>::RemoveAll() noexcept { void ObserversManager<T>::RemoveAll() noexcept {
if (not m_tree.empty()) { if (not m_tree.empty()) {
for (typename TreeType::sibling_iterator it(m_tree.begin()), itEND(m_tree.end()); it != itEND; ++it) { for (typename TreeType::sibling_iterator it(m_tree.begin()), itEND(m_tree.end()); it != itEND;) {
const TicketType ticket = it->ticket; const TicketType ticket = it->ticket;
++it;
this->Remove(ticket); this->Remove(ticket);
} }
assert(m_tree.empty()); assert(m_tree.empty());