diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-15 15:33:54 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-15 15:34:09 +0300 |
commit | 44b60862c97e5ec855d2bacd4d15f81f7ae7f410 (patch) | |
tree | cfe6fd232fac8c80c2f7673804352b94187d698b /plugins/NewXstatusNotify | |
parent | 0a03c7c9ccd36ce03bdb9feb4827314e4dd553c6 (diff) |
MUCH more effective way of removing records from iterators
Diffstat (limited to 'plugins/NewXstatusNotify')
-rw-r--r-- | plugins/NewXstatusNotify/src/xstatus.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index a582c8e5c7..c15cf4e746 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -42,30 +42,33 @@ void FreeXSC(XSTATUSCHANGE *xsc) void RemoveLoggedEventsXStatus(MCONTACT hContact)
{
- for (auto &it : eventListXStatus.rev_iter())
+ auto T = eventListXStatus.rev_iter();
+ for (auto &it : T)
if (it->hContact == hContact) {
db_event_delete(it->hContact, it->hDBEvent);
- eventListXStatus.remove(it);
+ eventListXStatus.remove(T.indexOf(&it));
mir_free(it);
}
}
void RemoveLoggedEventsStatus(MCONTACT hContact)
{
- for (auto &it : eventListStatus.rev_iter())
+ auto T = eventListStatus.rev_iter();
+ for (auto &it : T)
if (it->hContact == hContact) {
db_event_delete(it->hContact, it->hDBEvent);
- eventListStatus.remove(it);
+ eventListStatus.remove(T.indexOf(&it));
mir_free(it);
}
}
void RemoveLoggedEventsSMsg(MCONTACT hContact)
{
- for (auto &it : eventListSMsg.rev_iter())
+ auto T = eventListSMsg.rev_iter();
+ for (auto &it : T)
if (it->hContact == hContact) {
db_event_delete(it->hContact, it->hDBEvent);
- eventListSMsg.remove(it);
+ eventListSMsg.remove(T.indexOf(&it));
mir_free(it);
}
}
|