Fix a regression of fail removing different architecture plugins

This commit is contained in:
Don HO 2018-11-12 03:37:42 +01:00
parent 0abde25440
commit 17ac06f83a
3 changed files with 6 additions and 8 deletions

View File

@ -114,7 +114,7 @@ cleanup: // release all of our handles
return machine_type; return machine_type;
} }
int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_string> & dll2Remove) int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
{ {
const TCHAR *pluginFileName = ::PathFindFileName(pluginFilePath); const TCHAR *pluginFileName = ::PathFindFileName(pluginFilePath);
if (isInLoadedDlls(pluginFileName)) if (isInLoadedDlls(pluginFileName))
@ -269,7 +269,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
s += USERMSG; s += USERMSG;
if (::MessageBox(NULL, s.c_str(), pluginFilePath, MB_YESNO) == IDYES) if (::MessageBox(NULL, s.c_str(), pluginFilePath, MB_YESNO) == IDYES)
{ {
dll2Remove.push_back(pluginFilePath); ::DeleteFile(pluginFilePath);
} }
delete pi; delete pi;
return -1; return -1;
@ -282,7 +282,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
msg += USERMSG; msg += USERMSG;
if (::MessageBox(NULL, msg.c_str(), pluginFilePath, MB_YESNO) == IDYES) if (::MessageBox(NULL, msg.c_str(), pluginFilePath, MB_YESNO) == IDYES)
{ {
dll2Remove.push_back(pluginFilePath); ::DeleteFile(pluginFilePath);
} }
delete pi; delete pi;
return -1; return -1;
@ -295,7 +295,6 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir)
return false; return false;
vector<generic_string> dllNames; vector<generic_string> dllNames;
vector<generic_string> dll2Remove;
NppParameters * nppParams = NppParameters::getInstance(); NppParameters * nppParams = NppParameters::getInstance();
generic_string nppPath = nppParams->getNppPath(); generic_string nppPath = nppParams->getNppPath();
@ -363,7 +362,7 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir)
for (size_t i = 0, len = dllNames.size(); i < len; ++i) for (size_t i = 0, len = dllNames.size(); i < len; ++i)
{ {
loadPlugin(dllNames[i].c_str(), dll2Remove); loadPlugin(dllNames[i].c_str());
} }
return true; return true;

View File

@ -99,7 +99,7 @@ public:
_nppData = nppData; _nppData = nppData;
} }
int loadPlugin(const TCHAR *pluginFilePath, std::vector<generic_string> & dll2Remove); int loadPlugin(const TCHAR *pluginFilePath);
bool loadPluginsV2(const TCHAR *dir = NULL); bool loadPluginsV2(const TCHAR *dir = NULL);
bool unloadPlugin(int index, HWND nppHandle); bool unloadPlugin(int index, HWND nppHandle);

View File

@ -2437,10 +2437,9 @@ void Notepad_plus::command(int id)
vector<generic_string> copiedFiles = addNppComponents(destDir, extFilterName, extFilter); vector<generic_string> copiedFiles = addNppComponents(destDir, extFilterName, extFilter);
// load plugin // load plugin
vector<generic_string> dll2Remove;
for (size_t i = 0, len = copiedFiles.size() ; i < len ; ++i) for (size_t i = 0, len = copiedFiles.size() ; i < len ; ++i)
{ {
int index = _pluginsManager.loadPlugin(copiedFiles[i].c_str(), dll2Remove); int index = _pluginsManager.loadPlugin(copiedFiles[i].c_str());
if (_pluginsManager.getMenuHandle()) if (_pluginsManager.getMenuHandle())
_pluginsManager.addInMenuFromPMIndex(index); _pluginsManager.addInMenuFromPMIndex(index);
} }