summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-15 15:33:54 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-15 15:34:09 +0300
commit44b60862c97e5ec855d2bacd4d15f81f7ae7f410 (patch)
treecfe6fd232fac8c80c2f7673804352b94187d698b /plugins/UserInfoEx
parent0a03c7c9ccd36ce03bdb9feb4827314e4dd553c6 (diff)
MUCH more effective way of removing records from iterators
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r--plugins/UserInfoEx/src/mir_contactqueue.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp
index 752a9fbbc5..9ba36425ad 100644
--- a/plugins/UserInfoEx/src/mir_contactqueue.cpp
+++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp
@@ -83,9 +83,10 @@ void CContactQueue::RemoveAll(MCONTACT hContact)
{
mir_cslock lck(_cs);
- for (auto &qi : _queue.rev_iter()) {
+ auto T = _queue.rev_iter();
+ for (auto &qi : T) {
if (qi->hContact == hContact) {
- _queue.remove(qi);
+ _queue.remove(T.indexOf(&qi));
mir_free(qi);
}
}
@@ -98,9 +99,10 @@ void CContactQueue::RemoveAllConsiderParam(MCONTACT hContact, PVOID param)
{
mir_cslock lck(_cs);
- for (auto &qi : _queue.rev_iter())
+ auto T = _queue.rev_iter();
+ for (auto &qi : T)
if (qi->hContact == hContact && qi->param == param) {
- _queue.remove(qi);
+ _queue.remove(T.indexOf(&qi));
mir_free(qi);
}
}