From ff846551819603c954165dff4d42c1ec21b2cb9f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 29 Feb 2024 12:32:53 +0300 Subject: =?UTF-8?q?fixes=20#4253=20(Telegram:=20=D0=BF=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B7=D0=BA=D0=B5=20=D0=B8=D1=81=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/proto.h | 2 ++ protocols/Telegram/src/server.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'protocols/Telegram/src') diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 9e755fb1c6..acf288aeba 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -207,6 +207,8 @@ class CTelegramProto : public PROTO CMStringA m_defaultEmoji; OBJLIST m_arOwnMsg; + + mir_cs m_csRequests; OBJLIST m_arRequests; mir_cs m_csFiles; 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(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(pFunc)); - if (pHandler) + if (pHandler) { + mir_cslock lck(m_csRequests); m_arRequests.insert(new TG_REQUEST_FULL(queryId, pHandler, pUserInfo)); + } return queryId; } -- cgit v1.2.3