summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/newplugins.cpp15
-rw-r--r--src/mir_app/src/pluginopts.cpp22
2 files changed, 22 insertions, 15 deletions
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 4dca4ebb85..6a79d72330 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -532,9 +532,11 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
// contact list is loaded via clistlink, db - via DATABASELINK
// so we should call Load() only for usual plugins
- if (!p->bLoaded && !p->bIsClist && !p->bIsDatabase) {
- if (p->load() != 0)
+ if (!p->bFailed && !p->bLoaded && !p->bIsClist && !p->bIsDatabase) {
+ if (p->load() != 0) {
+ p->bFailed = true;
return false;
+ }
p->bLoaded = true;
if (p->m_pInterfaces) {
@@ -733,13 +735,8 @@ int LoadNewPluginsModule(void)
SetPluginOnWhiteList(p->pluginname, plugin_clist == p);
// now loop thru and load all the other plugins, do this in one pass
- for (int i = 0; i < pluginList.getCount(); i++) {
- pluginEntry *p = pluginList[i];
- if (!TryLoadPlugin(p, false)) {
- Plugin_Uninit(p);
- i--;
- }
- }
+ for (int i = 0; i < pluginList.getCount(); i++)
+ TryLoadPlugin(pluginList[i], false);
for (auto &it : servicePlugins.rev_iter())
if (!IsPluginOnWhiteList(it->pluginname))
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index 593d4978aa..c601a83072 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -29,6 +29,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HANDLE hevLoadModule;
+static pluginEntry* FindPlugin(const wchar_t *pszPlugin)
+{
+ pluginEntry tmp;
+ strncpy_s(tmp.pluginname, _T2A(pszPlugin), _TRUNCATE);
+ return pluginList.find(&tmp);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Plugins options page dialog
@@ -111,7 +118,13 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM
bNeedsFree = true;
}
- else ppb = &GetPluginByInstance(hInst);
+ else {
+ if (auto *pPlug = FindPlugin(fd->cFileName))
+ if (pPlug->bFailed)
+ return true;
+
+ ppb = &GetPluginByInstance(hInst);
+ }
PluginListItemData *dat = (PluginListItemData*)mir_calloc(sizeof(PluginListItemData));
dat->hInst = hInst;
@@ -250,17 +263,14 @@ static bool LoadPluginDynamically(PluginListItemData *dat)
static bool UnloadPluginDynamically(PluginListItemData *dat)
{
- pluginEntry tmp;
- strncpy_s(tmp.pluginname, _T2A(dat->fileName), _TRUNCATE);
-
- pluginEntry *p = pluginList.find(&tmp);
- if (p) {
+ if (auto *p = FindPlugin(dat->fileName)) {
if (!Plugin_UnloadDyn(p))
return false;
dat->bWasLoaded = false;
dat->hInst = nullptr;
}
+
return true;
}