diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 19a1efa57..22db8db69 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -275,10 +275,14 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath) s += USERMSG; if (::MessageBox(NULL, s.c_str(), pluginFilePath, MB_YESNO) == IDYES) { + if (pi && pi->_hLib) + { + ::FreeLibrary(pi->_hLib); + } ::DeleteFile(pluginFilePath); } delete pi; - return -1; + return -1; } catch (...) { @@ -288,10 +292,14 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath) msg += USERMSG; if (::MessageBox(NULL, msg.c_str(), pluginFilePath, MB_YESNO) == IDYES) { + if (pi && pi->_hLib) + { + ::FreeLibrary(pi->_hLib); + } ::DeleteFile(pluginFilePath); } delete pi; - return -1; + return -1; } }