diff options
author | George Hazan <george.hazan@gmail.com> | 2024-03-15 18:44:23 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-03-15 18:44:23 +0300 |
commit | 478b3261723a914310271ece3ef91abc9ce2b4cc (patch) | |
tree | 8d17bcee5692fe8085f624533c1f4f796754bbf1 /protocols/Telegram | |
parent | f621aac0cb42e0de9de6f1f05a0b4383eb791930 (diff) |
fixes #4214 ([Telegram] Crash)
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/src/avatars.cpp | 5 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 6 |
3 files changed, 5 insertions, 8 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index ed6efbd3de..dcfa894ced 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -149,11 +149,12 @@ INT_PTR __cdecl CTelegramProto::SvcOfflineFile(WPARAM param, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// Cloud file pre-creator
-void CTelegramProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *pHandle)
+void CTelegramProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob)
{
- if (auto *ft = (TG_FILE_REQUEST *)pHandle) {
+ if (auto *ft = (TG_FILE_REQUEST *)blob.getUserInfo()) {
blob.setUrl(ft->m_uniqueId.GetBuffer());
blob.setSize(ft->m_fileSize);
+ delete ft;
}
}
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index b4df98a636..141a2d3034 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -384,7 +384,7 @@ public: void OnEventEdited(MCONTACT, MEVENT, const DBEVENTINFO &dbei) override; void OnMarkRead(MCONTACT, MEVENT) override; void OnModulesLoaded() override; - void OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *ft) override; + void OnReceiveOfflineFile(DB::FILE_BLOB &blob) override; void OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *hTransfer) override; void OnShutdown() override; diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index ef19a92d3e..71a17bd3b6 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -403,10 +403,6 @@ bool CTelegramProto::GetMessageFile( pRequest->m_fileSize = pFile->size_;
pRequest->m_bRecv = !pMsg->is_outgoing_;
pRequest->m_hContact = GetRealContact(pUser);
- {
- mir_cslock lck(m_csFiles);
- m_arFiles.insert(pRequest);
- }
char szReplyId[100];
const char *szDesc = nullptr;
@@ -430,7 +426,7 @@ bool CTelegramProto::GetMessageFile( if (dbei) {
DB::FILE_BLOB blob(dbei);
- OnReceiveOfflineFile(blob, pRequest);
+ OnReceiveOfflineFile(blob);
blob.write(dbei);
db_event_edit(hDbEvent, &dbei, true);
delete pRequest;
|