diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-26 16:34:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-26 16:34:25 +0300 |
commit | ba6d2b8aa2e9cb606da216584ea90e9f6736b3cf (patch) | |
tree | 716e966b5dc42503c3ec1e17f67e2ea2152bbb91 | |
parent | 9e0c35d15d5f2b6a3380aee828d5d1a735d552f7 (diff) |
fixes #2862 (random crash in ICQ protocol)
-rw-r--r-- | protocols/ICQ-WIM/src/ignore.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/protocols/ICQ-WIM/src/ignore.cpp b/protocols/ICQ-WIM/src/ignore.cpp index a280d1ab80..00578d6c17 100644 --- a/protocols/ICQ-WIM/src/ignore.cpp +++ b/protocols/ICQ-WIM/src/ignore.cpp @@ -35,8 +35,10 @@ void CIcqProto::OnGetPermitDeny(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) void CIcqProto::ProcessPermissions(const JSONNode &ev) { - for (auto &it : m_arCache) - it->m_iApparentMode = 0; + { mir_cslock lck(m_csCache); + for (auto &it : m_arCache) + it->m_iApparentMode = 0; + } for (auto &it : ev["allows"]) { auto *p = FindContactByUIN(it.as_mstring()); @@ -57,13 +59,15 @@ void CIcqProto::ProcessPermissions(const JSONNode &ev) m_bIgnoreListEmpty = false; } - for (auto &it: m_arCache) { - int oldMode = getDword(it->m_hContact, "ApparentMode"); - if (oldMode != it->m_iApparentMode) { - if (it->m_iApparentMode == 0) - delSetting(it->m_hContact, "ApparentMode"); - else - setDword(it->m_hContact, "ApparentMode", it->m_iApparentMode); + { mir_cslock lck(m_csCache); + for (auto &it : m_arCache) { + int oldMode = getDword(it->m_hContact, "ApparentMode"); + if (oldMode != it->m_iApparentMode) { + if (it->m_iApparentMode == 0) + delSetting(it->m_hContact, "ApparentMode"); + else + setDword(it->m_hContact, "ApparentMode", it->m_iApparentMode); + } } } } |