diff options
author | George Hazan <ghazan@miranda.im> | 2023-04-26 15:58:36 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-04-26 15:58:36 +0300 |
commit | 54a74ed96301e8a80d8dca769511954f43561714 (patch) | |
tree | 5569aefae01a1a8838bc9e56690d0204753990f1 /src | |
parent | 11cc2c18fb5578b757fdddb44f9730502025716d (diff) |
fix for crazy situation, when Scriver loads StdMsg while switching to tabSRMM
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 28 | ||||
-rw-r--r-- | src/mir_app/src/pluginopts.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/plugins.h | 1 |
3 files changed, 23 insertions, 12 deletions
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index d9508f7874..01b7de292c 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PLUGINDISABLELIST "PluginDisable"
-bool g_bReadyToInitClist = false;
+bool g_bReadyToInitClist = false, g_bLoadStd = false;
void LoadExtraIconsModule();
void freePluginInstance(HINSTANCE hInst);
@@ -317,15 +317,17 @@ bool Plugin_UnloadDyn(pluginEntry *p) if (!p->bIsCore)
for (auto &it : pluginDefault)
if (it.pImpl == p) {
- if (!it.Preload()) {
- MessageBoxW(nullptr,
- CMStringW(FORMAT, TranslateT("Plugin %S cannot be unloaded because the core plugin is missing"), p->pluginname),
- L"Miranda", MB_ICONERROR | MB_OK);
- it.pImpl = p;
- return false;
- }
+ if (g_bLoadStd) {
+ if (!it.Preload()) {
+ MessageBoxW(nullptr,
+ CMStringW(FORMAT, TranslateT("Plugin %S cannot be unloaded because the core plugin is missing"), p->pluginname),
+ L"Miranda", MB_ICONERROR | MB_OK);
+ it.pImpl = p;
+ return false;
+ }
- stdPlugin = ⁢
+ stdPlugin = ⁢
+ }
break;
}
@@ -530,9 +532,13 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) }
}
+ // if this plugin already failed, don't try to load it twice
+ if (p->bFailed)
+ return false;
+
// contact list is loaded via clistlink, db - via DATABASELINK
// so we should call Load() only for usual plugins
- if (!p->bFailed && !p->bLoaded && !p->bIsClist && !p->bIsDatabase) {
+ if (!p->bLoaded && !p->bIsClist && !p->bIsDatabase) {
if (p->load() != 0) {
p->bFailed = true;
return false;
@@ -758,6 +764,8 @@ int LoadNewPluginsModule(void) int LoadStdPlugins()
{
+ g_bLoadStd = true;
+
for (auto &it : pluginDefault) {
if (it.pImpl)
continue;
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 7e58c5fca3..28adc83d0a 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -255,7 +255,6 @@ static bool LoadPluginDynamically(PluginListItemData *dat) }
}
- dat->bWasLoaded = true;
dat->hInst = ppb->getInst();
NotifyFastHook(hevLoadModule, (WPARAM)ppb, (LPARAM)ppb->getInst());
return true;
@@ -267,7 +266,6 @@ static bool UnloadPluginDynamically(PluginListItemData *dat) if (!Plugin_UnloadDyn(p))
return false;
- dat->bWasLoaded = false;
dat->hInst = nullptr;
}
@@ -376,6 +374,7 @@ public: CMStringW bufRestart(TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
bufRestart.AppendChar('\n');
+ g_bLoadStd = false;
for (int iRow = 0; iRow != -1;) {
wchar_t buf[1024];
m_plugList.GetItemText(iRow, 0, buf, _countof(buf));
@@ -413,12 +412,15 @@ public: }
}
}
+
+ dat->bWasLoaded = dat->hInst != nullptr;
}
}
SetPluginOnWhiteList(_T2A(buf), (iState & 0x2000) != 0);
iRow = m_plugList.GetNextItem(iRow, LVNI_ALL);
}
+
LoadStdPlugins();
ShowWindow(GetDlgItem(m_hwnd, IDC_RESTART), needRestart);
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index aad6d35a9a..6f0afacb76 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -55,6 +55,7 @@ struct pluginEntry extern LIST<pluginEntry> pluginList, servicePlugins, clistPlugins;
extern MUUID miid_last;
+extern bool g_bLoadStd;
int PluginOptionsInit(WPARAM, LPARAM);
|