@@ -47,6 +47,10 @@ bool PluginsManager::unloadPlugin(int index, HWND nppHandle)
4747
4848int PluginsManager::loadPlugin (const TCHAR *pluginFilePath, vector<generic_string> & dll2Remove)
4949{
50+ const TCHAR *pluginFileName = ::PathFindFileName (pluginFilePath);
51+ if (isInLoadedDlls (pluginFileName))
52+ return 0 ;
53+
5054 PluginInfo *pi = new PluginInfo;
5155 try {
5256 pi->_moduleName = PathFindFileName (pluginFilePath);
@@ -181,7 +185,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
181185 ::SendMessage (_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0 , (LPARAM)pDllName);
182186
183187 }
184-
188+ addInLoadedDlls (pluginFileName);
185189 _pluginInfos.push_back (pi);
186190 return (_pluginInfos.size () - 1 );
187191 } catch (std::exception e) {
@@ -217,8 +221,8 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
217221
218222 vector<generic_string> dllNames;
219223 vector<generic_string> dll2Remove;
220- generic_string nppPath = ( NppParameters::getInstance ())-> getNppPath ();
221-
224+ NppParameters * nppParams = NppParameters::getInstance ();
225+ generic_string nppPath = nppParams-> getNppPath ();
222226 generic_string pluginsFullPathFilter = (dir && dir[0 ])?dir:nppPath;
223227
224228 pluginsFullPathFilter += TEXT (" \\ plugins\\ *.dll" );
@@ -232,8 +236,6 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
232236 plugins1stFullPath += foundData.cFileName ;
233237 dllNames.push_back (plugins1stFullPath);
234238
235- NppParameters * nppParams = NppParameters::getInstance ();
236-
237239 while (::FindNextFile (hFindFile, &foundData))
238240 {
239241 bool isInBlackList = nppParams->isInBlackList (foundData.cFileName );
0 commit comments