From 39ba883f900476abb99658543f8b5fac2af3be87 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 7 Jun 2022 15:02:54 -0300 Subject: [PATCH] Fix bugs executing plugin init/exit() functions in different situations Reinstalling a previously enabled plugin extension wasn't running the init() function, and uninstalling it wasn't calling its exit() function. --- src/app/extensions.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/extensions.cpp b/src/app/extensions.cpp index 5874c4287..1050b827b 100644 --- a/src/app/extensions.cpp +++ b/src/app/extensions.cpp @@ -332,14 +332,12 @@ bool Extension::canBeUninstalled() const void Extension::enable(const bool state) { - // Do nothing - if (m_isEnabled == state) - return; + if (m_isEnabled != state) { + set_config_bool("extensions", m_name.c_str(), state); + flush_config_file(); - set_config_bool("extensions", m_name.c_str(), state); - flush_config_file(); - - m_isEnabled = state; + m_isEnabled = state; + } #ifdef ENABLE_SCRIPTING if (hasScripts()) { @@ -365,6 +363,9 @@ void Extension::uninstall(const DeletePluginPref delPref) TRACE("EXT: Uninstall extension '%s' from '%s'...\n", m_name.c_str(), m_path.c_str()); + // Execute exit actions of scripts + executeExitActions(); + // Remove all files inside the extension path uninstallFiles(m_path, delPref); ASSERT(!base::is_directory(m_path) || delPref == DeletePluginPref::kNo);