Let the plugin clean itself up

This commit is contained in:
Mm2PL 2024-10-05 23:45:53 +02:00
parent c9656399d1
commit 586f6327d3
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9

View file

@ -349,14 +349,8 @@ bool PluginController::reload(const QString &id)
{
getApp()->getCommands()->unregisterPluginCommand(cmd);
}
it->second->ownedCommands.clear();
if (it->second->state_ != nullptr)
{
lua_close(it->second->state_);
it->second->state_ = nullptr;
}
QDir loadDir = it->second->loadDirectory_;
// Since Plugin owns the state, it will clean up everything related to it
this->plugins_.erase(id);
this->tryLoadFromDir(loadDir);
return true;