diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-24 20:42:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-24 20:42:20 +0300 |
commit | 799519203a9a94d711f580c9c50a5d73466bdde6 (patch) | |
tree | 07a5e4def6b8f7ebbd60b8a1d6924233a9693dcc /protocols/ICQ-WIM/src | |
parent | 429f6f8dc6e73348426b58b388360ce94507092c (diff) |
fixes #3452 (ICQ: crash on ProcessBuddyList)
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 1 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/utils.cpp | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index 9b1e5aae92..c507c3babb 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -69,6 +69,7 @@ void CIcqProto::ProcessBuddyList(const JSONNode &ev) if (bEnableMenu)
Menu_ShowItem(m_hUploadGroups, true);
+ mir_cslock lck(m_csCache);
for (auto &it : m_arCache)
if (!it->m_bInList && !getBool(it->m_hContact, "IcqDeleted"))
Contact::RemoveFromList(it->m_hContact);
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 1e6ffb5ada..8ee9b60d8b 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -154,8 +154,10 @@ void CIcqProto::OnContactAdded(MCONTACT hContact) void CIcqProto::OnContactDeleted(MCONTACT hContact)
{
CMStringW szId(GetUserId(hContact));
- if (!isChatRoom(hContact))
+ if (!isChatRoom(hContact)) {
+ mir_cslock lck(m_csCache);
m_arCache.remove(FindUser(szId));
+ }
Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/buddylist/removeBuddy")
<< AIMSID(this) << WCHAR_PARAM("buddy", szId) << INT_PARAM("allGroups", 1));
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index bdaac877bf..83d876adb0 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -46,6 +46,8 @@ void CIcqProto::InitContactCache() auto *pUser = FindUser(wszId);
if (pUser == nullptr) {
pUser = new IcqUser(wszId, it);
+
+ mir_cslock lck(m_csCache);
m_arCache.insert(pUser);
}
pUser->m_iProcessedMsgId = getId(it, DB_KEY_LASTMSGID);
|