Fix incompatible plugin not being deleted issue

Unload incompatible plugin before deleting it.

Fix #9377, close #9382
This commit is contained in:
Christian Grasser 2021-01-10 20:20:00 +01:00 committed by Don HO
parent b58a5cc227
commit a55d46d170
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -275,6 +275,10 @@ 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;
@ -288,6 +292,10 @@ 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;