summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-05-22 12:28:49 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-05-22 12:28:49 +0300
commitee0691d3871c2d95906b5171d2ed6e9a95588dbc (patch)
tree507c342ef4eb1f00b5ab73d900098609ab831065
parent7c07d4e6578b0eab6de015ab7c1126e2f8fa4a13 (diff)
fixes #5026 (CrashDumper: падение при вызове любого пункта меню, связанного с плагином)
-rw-r--r--include/m_srmm_int.h2
-rw-r--r--libs/win32/mir_app.libbin309306 -> 309246 bytes
-rw-r--r--libs/win64/mir_app.libbin309492 -> 309426 bytes
-rw-r--r--plugins/CrashDumper/src/dumper.cpp11
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/srmm_base.cpp2
-rw-r--r--src/mir_app/src/srmm_log.cpp16
8 files changed, 19 insertions, 16 deletions
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h
index bfcce6d31d..3b9e49b210 100644
--- a/include/m_srmm_int.h
+++ b/include/m_srmm_int.h
@@ -184,7 +184,7 @@ struct SrmmLogWindowClass
pfnSrmmLogCreator pfnBuilder;
};
-MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(CMsgDialog *pDlg);
+MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(bool bGC, MCONTACT hContact = INVALID_CONTACT_ID);
/////////////////////////////////////////////////////////////////////////////////////////
// Simple single-event based logger
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index a6d11d98be..d7664e4e94 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index bb01d59223..3ba5c5399c 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp
index cd11487007..80897d6f46 100644
--- a/plugins/CrashDumper/src/dumper.cpp
+++ b/plugins/CrashDumper/src/dumper.cpp
@@ -138,10 +138,15 @@ static void GetPluginsString(CMStringW &buffer, unsigned &flags)
{
buffer.AppendFormat(L"Service Mode: %s\r\n", g_plugin.bServiceMode ? L"Yes" : L"No");
- if (auto *pLogClass = Srmm_GetWindowClass(0))
- buffer.AppendFormat(L"SRMM Log Viewer: %s\r\n", _A2T(pLogClass->szShortName).get());
+ if (auto *pLogClass = Srmm_GetWindowClass(false))
+ buffer.AppendFormat(L"SRMM Log Viewer: %S\r\n", pLogClass->szShortName.get());
else
- buffer.AppendFormat(L"SRMM Log Viewer: %s\r\n", L"missing");
+ buffer.AppendFormat(L"SRMM Log Viewer: %S\r\n", "missing");
+
+ if (auto *pLogClass = Srmm_GetWindowClass(true))
+ buffer.AppendFormat(L"SRMM Groupchat Log Viewer: %S\r\n", pLogClass->szShortName.get());
+ else
+ buffer.AppendFormat(L"SRMM Groupchat Log Viewer: %S\r\n", "missing");
wchar_t path[MAX_PATH];
GetModuleFileName(nullptr, path, MAX_PATH);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index eba807313d..ef8f3858d5 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -892,7 +892,7 @@ Clist_GroupSaveExpanded @1003 NONAME
?GetInput@CSrmmBaseDialog@@QBEPAUHWND__@@XZ @1024 NONAME
?Srmm_ApplyOptions@@YGXXZ @1025 NONAME
?OnOptionsApplied@CSrmmBaseDialog@@UAEXXZ @1026 NONAME
-?Srmm_GetWindowClass@@YGPAUSrmmLogWindowClass@@PAVCMsgDialog@@@Z @1027 NONAME
+?Srmm_GetWindowClass@@YGPAUSrmmLogWindowClass@@_NI@Z @1027 NONAME
?addColor@CMPluginBase@@QAEHPBD0PB_W1K@Z @1028 NONAME
?addFont@CMPluginBase@@QAEHPBD0PB_W111HHPAUtagLOGFONTW@@K@Z @1029 NONAME
?IsReadonly@Contact@@YG_NI@Z @1030 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index aa2b1a2bbb..f69bb6e58d 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -892,7 +892,7 @@ Clist_GroupSaveExpanded @1003 NONAME
?GetInput@CSrmmBaseDialog@@QEBAPEAUHWND__@@XZ @1024 NONAME
?Srmm_ApplyOptions@@YAXXZ @1025 NONAME
?OnOptionsApplied@CSrmmBaseDialog@@UEAAXXZ @1026 NONAME
-?Srmm_GetWindowClass@@YAPEAUSrmmLogWindowClass@@PEAVCMsgDialog@@@Z @1027 NONAME
+?Srmm_GetWindowClass@@YAPEAUSrmmLogWindowClass@@_NI@Z @1027 NONAME
?addColor@CMPluginBase@@QEAAHPEBD0PEB_W1K@Z @1028 NONAME
?addFont@CMPluginBase@@QEAAHPEBD0PEB_W111HHPEAUtagLOGFONTW@@K@Z @1029 NONAME
?IsReadonly@Contact@@YA_NI@Z @1030 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 52c19a6b20..2268f3c30a 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -516,7 +516,7 @@ bool CSrmmBaseDialog::OnInitDialog()
m_message.Hide();
auto *pDlg = (CMsgDialog *)this;
- if (auto *pLogWindowClass = Srmm_GetWindowClass(pDlg)) {
+ if (auto *pLogWindowClass = Srmm_GetWindowClass(pDlg->isChat(), pDlg->m_hContact)) {
m_pLog = pLogWindowClass->pfnBuilder(*pDlg);
m_pLog->Attach();
if (m_pLog->GetType() != 0) { // custom log type
diff --git a/src/mir_app/src/srmm_log.cpp b/src/mir_app/src/srmm_log.cpp
index 00e2982282..a2d094ce1a 100644
--- a/src/mir_app/src/srmm_log.cpp
+++ b/src/mir_app/src/srmm_log.cpp
@@ -42,14 +42,14 @@ void CheckLogOptions()
/////////////////////////////////////////////////////////////////////////////////////////
-static bool sttEnableCustomLogs(CMsgDialog *pDlg)
+static bool sttEnableCustomLogs(MCONTACT hContact)
{
// always enable custom log viewers for private chats
- if (!pDlg)
+ if (hContact == INVALID_CONTACT_ID)
return true;
// check if custom viewers are forbidden for this particular account
- auto *szProto = Proto_GetBaseAccountName(pDlg->m_hContact);
+ auto *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
// hidden setting !!!!!!!!
CMStringA szProtoList(db_get_sm(0, SRMM_MODULE, "DisableCustomLogsForProto"));
@@ -69,14 +69,12 @@ static bool sttEnableCustomLogs(CMsgDialog *pDlg)
return true;
}
-MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(CMsgDialog *pDlg)
+MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(bool bGC, MCONTACT hContact)
{
- if (sttEnableCustomLogs(pDlg)) {
- CMStringA szViewerName;
- if (pDlg != nullptr)
- szViewerName = db_get_sm(pDlg->m_hContact, SRMSGMOD, pDlg->isChat() ? "LoggerGC" : "Logger");
+ if (sttEnableCustomLogs(hContact)) {
+ CMStringA szViewerName(db_get_sm(hContact, SRMSGMOD, bGC ? "LoggerGC" : "Logger"));
if (szViewerName.IsEmpty())
- szViewerName = pDlg->isChat() ? g_loggerGC : g_logger;
+ szViewerName = bGC ? g_loggerGC : g_logger;
for (auto &it : g_arLogClasses)
if (szViewerName == it->szShortName)