summaryrefslogtreecommitdiff
path: root/plugins/FavContacts/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FavContacts/src')
-rw-r--r--plugins/FavContacts/src/contact_cache.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp
index 5ebd3f1c71..6cf3b37761 100644
--- a/plugins/FavContacts/src/contact_cache.cpp
+++ b/plugins/FavContacts/src/contact_cache.cpp
@@ -38,12 +38,13 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent)
TContactInfo *pFound = nullptr;
mir_cslock lck(m_cs);
- for (auto &it : m_cache.rev_iter()) {
+ auto T = m_cache.rev_iter();
+ for (auto &it : T) {
it->rate *= q;
if (it->hContact == hContact) {
it->rate += weight;
pFound = it;
- m_cache.remove(it); // reinsert to maintain the sort order
+ m_cache.remove(T.indexOf(&it)); // reinsert to maintain the sort order
}
}