summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-17 18:56:10 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-17 18:56:10 +0300
commit869ef8197ffd76c3a76ae00dd6b168413e105c86 (patch)
tree1f3a4e93f2153619c453ebed22ba4b7921ec6048
parent44a4b1bce05a0c8850030877586de85c7efc1b31 (diff)
fixes #4209 (Падение при выгрузке некоторых плагинов)
-rw-r--r--src/mir_app/src/miranda.h4
-rw-r--r--src/mir_app/src/options.cpp25
-rw-r--r--src/mir_app/src/proto_accs.cpp1
3 files changed, 30 insertions, 0 deletions
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index d87d66f9b5..6d12620e38 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -59,6 +59,10 @@ const char* GetPluginNameByInstance(HINSTANCE hInstance);
int LoadStdPlugins(void);
int LaunchServicePlugin(pluginEntry *p);
+/**** options.cpp **********************************************************************/
+
+void KillObjectOptions(PROTO_INTERFACE *p);
+
/**** path.cpp *************************************************************************/
void InitPathVar(void);
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index 2c0cada881..f0943b6c1e 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -1125,6 +1125,25 @@ public:
}
}
+ void KillAccount(PROTO_INTERFACE *ppro)
+ {
+ for (auto &opd : m_arOpd) {
+ if (opd->pDialog == nullptr)
+ continue;
+
+ if (auto *pDlg = dynamic_cast<CProtoIntDlgBase *>(opd->pDialog)) {
+ if (pDlg->GetProtoInterface() == ppro) {
+ opd->pDialog->Close();
+ opd->pDialog = nullptr;
+ m_arDeleted.insert(opd);
+ }
+ }
+ }
+
+ if (m_arDeleted.getCount())
+ m_timerRebuild.Start(50);
+ }
+
void KillModule(HPLUGIN pPlugin)
{
for (auto &opd : m_arOpd) {
@@ -1246,6 +1265,12 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, HPLUGIN
/////////////////////////////////////////////////////////////////////////////////////////
+void KillObjectOptions(PROTO_INTERFACE *ppro)
+{
+ if (pOptionsDlg != nullptr)
+ pOptionsDlg->KillAccount(ppro);
+}
+
MIR_APP_DLL(void) KillModuleOptions(HPLUGIN pPlugin)
{
if (pOptionsDlg != nullptr)
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index fb39c23ed7..e0b3f02452 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -305,6 +305,7 @@ static void __cdecl DeactivationThread(DeactivationThreadParam *param)
p->OnShutdown();
}
+ KillObjectOptions(p);
KillObjectThreads(p); // waits for them before terminating
KillObjectEventHooks(p); // untie an object from the outside world