summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-06-18 21:51:30 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-06-18 21:51:30 +0300
commite503f800768d5d794ca033a89f92e5b21d7eeee3 (patch)
treee4272bc0d09e0429ddcd4ce47f104353148c15f3 /src
parent8f5c72980a4511dd125cfcfe2038dfea8294e9e1 (diff)
fixes #3561 (random crash inside chat engine)
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat_manager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index b0c4999d89..ea74717a14 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -226,6 +226,7 @@ BOOL SM_RemoveUser(SESSION_INFO *si, const wchar_t *pszUID)
if (!si || !pszUID)
return FALSE;
+ mir_cslock lck(si->csLock);
USERINFO *ui = UM_FindUser(si, pszUID);
if (!ui)
return FALSE;
@@ -586,6 +587,7 @@ static USERINFO* UM_FindUser(SESSION_INFO *si, const wchar_t *pszUID)
if (!si || !pszUID)
return nullptr;
+ mir_cslock lck(si->csLock);
USERINFO tmp;
tmp.pszUID = (wchar_t*)pszUID;
return si->getKeyList().find(&tmp);
@@ -619,9 +621,10 @@ void UM_SortUser(SESSION_INFO *si)
USERINFO* UM_AddUser(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszNick, uint16_t wStatus)
{
- if (pszNick == nullptr)
+ if (!si || !pszUID || !pszNick)
return nullptr;
+ mir_cslock lck(si->csLock);
auto *pUser = UM_FindUser(si, pszUID);
if (pUser == nullptr) {
pUser = new USERINFO();