Update pluginmanager.cpp

This commit is contained in:
恍兮惚兮 2024-03-30 02:41:00 +08:00
parent c94547bbc9
commit c93e98a567

View File

@ -211,9 +211,12 @@ void Pluginmanager::remove(const std::wstring& wss,bool onlyload){
} }
else else
FreeLibrary(hm); FreeLibrary(hm);
OnNewSentenceS[wss].funcptr=OnNewSentenceS[wss].hmodule=0;
if(onlyload)return; if(onlyload){
OnNewSentenceS[wss].funcptr=OnNewSentenceS[wss].hmodule=0;
return;
}
auto s=WideStringToString(wss); auto s=WideStringToString(wss);
auto &plgs=configs->configs["plugins"]; auto &plgs=configs->configs["plugins"];
auto it=std::remove_if(plgs.begin(),plgs.end(),[&](auto&t){ auto it=std::remove_if(plgs.begin(),plgs.end(),[&](auto&t){
@ -221,6 +224,7 @@ void Pluginmanager::remove(const std::wstring& wss,bool onlyload){
return p==s; return p==s;
}); });
plgs.erase(it, plgs.end()); plgs.erase(it, plgs.end());
OnNewSentenceS.erase(wss);
} }
std::optional<std::wstring>Pluginmanager::selectpluginfile(){ std::optional<std::wstring>Pluginmanager::selectpluginfile(){
return SelectFile(0,L"Plugin Files\0*.dll;*.xdll\0"); return SelectFile(0,L"Plugin Files\0*.dll;*.xdll\0");