From f9d4be52548544305949dffedddc0d2044bdc45d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Nov 2024 17:32:44 +0300 Subject: fix for possible crash fix --- include/m_protosvc.h | 3 ++- libs/win32/mir_app.lib | Bin 301554 -> 301558 bytes libs/win64/mir_app.lib | Bin 301602 -> 301606 bytes src/mir_app/src/mir_app.def | 2 +- src/mir_app/src/mir_app64.def | 2 +- src/mir_app/src/srmm_log_rtf.cpp | 2 +- src/mir_app/src/srmm_util.cpp | 15 ++++++++------- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 2178655aaf..95914f26b7 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -724,13 +724,14 @@ __forceinline INT_PTR ProtoChainRecvFile(MCONTACT hContact, const DB::FILE_BLOB struct MIR_APP_EXPORT OFDTHREAD : public MNonCopyable { - OFDTHREAD(MEVENT hDbEvent, const CMStringW &path, int iCommand); + OFDTHREAD(MCONTACT, MEVENT hDbEvent, const CMStringW &path, int iCommand); ~OFDTHREAD(); void Finish(); void ResetFileName(const wchar_t *pwszNewName); MEVENT hDbEvent; + MCONTACT hContact; MFilePath wszPath; struct OFD_Callback *pCallback = nullptr; uint32_t dwTimestamp = 0; diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 65c5a6875f..aefec649ae 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 859fd2a292..f2db2e57a7 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 2bf1f10949..215a4fa344 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -861,7 +861,7 @@ Clist_RemoveEvent @989 ?Chat_EmptyHistory@@YGXPAUSESSION_INFO@@@Z @992 NONAME ?Utils_Unzip@@YG?AVMBinBuffer@@PBXI@Z @993 NONAME ?OnNickListTimer@CSrmmBaseDialog@@AAEXPAVCTimer@@@Z @994 NONAME -??0OFDTHREAD@@QAE@IABV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@H@Z @995 NONAME +??0OFDTHREAD@@QAE@IIABV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@H@Z @995 NONAME ??1OFDTHREAD@@QAE@XZ @996 NONAME ?Finish@OFDTHREAD@@QAEXXZ @997 NONAME ?getLocalName@FILE_BLOB@DB@@QBEPB_WXZ @998 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index e20374e539..7e0ae68dec 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -861,7 +861,7 @@ Clist_RemoveEvent @989 ?Chat_EmptyHistory@@YAXPEAUSESSION_INFO@@@Z @992 NONAME ?Utils_Unzip@@YA?AVMBinBuffer@@PEBX_K@Z @993 NONAME ?OnNickListTimer@CSrmmBaseDialog@@AEAAXPEAVCTimer@@@Z @994 NONAME -??0OFDTHREAD@@QEAA@IAEBV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@H@Z @995 NONAME +??0OFDTHREAD@@QEAA@IIAEBV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@H@Z @995 NONAME ??1OFDTHREAD@@QEAA@XZ @996 NONAME ?Finish@OFDTHREAD@@QEAAXXZ @997 NONAME ?getLocalName@FILE_BLOB@DB@@QEBAPEB_WXZ @998 NONAME diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index 75583cf1de..2653b7dc13 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -250,7 +250,7 @@ INT_PTR CRtfLogWindow::Notify(WPARAM, LPARAM lParam) case 4: { - OFDTHREAD *ofd = new OFDTHREAD(hDbEvent, L"", OFD_COPYURL); + OFDTHREAD *ofd = new OFDTHREAD(m_pDlg.m_hContact, hDbEvent, L"", OFD_COPYURL); ofd->pCallback = new OFD_CopyUrl(blob.getUrl()); CallProtoService(dbei.szModule, PS_OFFLINEFILE, (WPARAM)ofd); } diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index 7d499245a4..af46bbe25e 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -126,9 +126,10 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd) static mir_cs csLocked; static std::map arLocked; -OFDTHREAD::OFDTHREAD(MEVENT _1, const CMStringW &_2, int iCommand) : - hDbEvent(_1), - wszPath(_2) +OFDTHREAD::OFDTHREAD(MCONTACT _1, MEVENT _2, const CMStringW &_3, int iCommand) : + hContact(_1), + hDbEvent(_2), + wszPath(_3) { bOpen = (iCommand & OFD_RUN) != 0; bCopy = (iCommand & OFD_COPYURL) != 0; @@ -157,7 +158,7 @@ void OFDTHREAD::Finish() fclose(out); } - NotifyEventHooks(g_hevEventEdited, db_event_getContact(hDbEvent), hDbEvent); + NotifyEventHooks(g_hevEventEdited, hContact, hDbEvent); pCallback->Invoke(*this); } @@ -212,7 +213,7 @@ void DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, DB::EventInfo &dbei } if (bDownloaded) { - OFDTHREAD ofd(hDbEvent, blob.getLocalName(), iCommand); + OFDTHREAD ofd(hContact, hDbEvent, blob.getLocalName(), iCommand); pCallback->Invoke(ofd); } else { @@ -224,7 +225,7 @@ void DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, DB::EventInfo &dbei arLocked[hDbEvent] = true; } - OFDTHREAD *ofd = new OFDTHREAD(hDbEvent, blob.getLocalName(), iCommand); + OFDTHREAD *ofd = new OFDTHREAD(hContact, hDbEvent, blob.getLocalName(), iCommand); ofd->bLocked = true; ofd->dwTimestamp = dbei.timestamp; ofd->pCallback = callback.release(); @@ -244,7 +245,7 @@ MIR_APP_DLL(void) Srmm_DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, i switch (iCommand & 0xFFF) { case OFD_COPYURL: { - OFDTHREAD *ofd = new OFDTHREAD(hDbEvent, L"", iCommand); + OFDTHREAD *ofd = new OFDTHREAD(hContact, hDbEvent, L"", iCommand); ofd->pCallback = new OFD_CopyUrl(blob.getUrl()); CallProtoService(dbei.szModule, PS_OFFLINEFILE, (WPARAM)ofd); } -- cgit v1.2.3