summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-29 12:32:53 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-29 12:32:53 +0300
commitff846551819603c954165dff4d42c1ec21b2cb9f (patch)
tree211ed08991ef56be6f193c483c01f3b6c2aeda27 /protocols/Telegram/src/server.cpp
parentb2f33c6f47d37635d28b0d754a0b6e499078dd09 (diff)
fixes #4253 (Telegram: падение при загрузке истории)
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index f31e23f709..51da845681 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -176,6 +176,7 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response)
if (response.request_id) {
TG_REQUEST tmp(response.request_id, 0);
+ mir_cslock lck(m_csRequests);
auto *p = m_arRequests.find(&tmp);
if (p) {
p->Execute(this, response);
@@ -359,8 +360,10 @@ int CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler)
m_pClientManager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
- if (pHandler)
+ if (pHandler) {
+ mir_cslock lck(m_csRequests);
m_arRequests.insert(new TG_REQUEST(queryId, pHandler));
+ }
return queryId;
}
@@ -376,8 +379,10 @@ int CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandle
m_pClientManager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
- if (pHandler)
+ if (pHandler) {
+ mir_cslock lck(m_csRequests);
m_arRequests.insert(new TG_REQUEST_FULL(queryId, pHandler, pUserInfo));
+ }
return queryId;
}