From 586f6327d3043d8c7c52dd1b69c11040e1c44166 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 5 Oct 2024 23:45:53 +0200 Subject: [PATCH] Let the plugin clean itself up --- src/controllers/plugins/PluginController.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/controllers/plugins/PluginController.cpp b/src/controllers/plugins/PluginController.cpp index 4e5cc2ab2..024d89964 100644 --- a/src/controllers/plugins/PluginController.cpp +++ b/src/controllers/plugins/PluginController.cpp @@ -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;