If i is the first entry, then setting cur = begin() sets us up to point at
something that we are about to delete. Move the check to the end to avoid
this.
Backport: emperor, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
if (i == q.end())
return;
size -= i->second.size();
- if (i == cur) {
+ if (i == cur)
++cur;
- if (cur == q.end())
- cur = q.begin();
- }
if (out) {
for (typename list<pair<unsigned, T> >::reverse_iterator j =
i->second.rbegin();
}
}
q.erase(i);
+ if (cur == q.end())
+ cur = q.begin();
}
void dump(Formatter *f) const {