From fd76400e7265fa60eec3253c9ba105dec8ec5775 Mon Sep 17 00:00:00 2001 From: somewhatlurker <52014015+somewhatlurker@users.noreply.github.com> Date: Sun, 25 Aug 2019 17:07:55 +1000 Subject: [PATCH] launcher: fix plugins being loaded when not wanted --- source-code/source/plugins/Launcher/framework.h | 9 +++++---- source-code/source/plugins/Launcher/ui.h | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index a39444e..95a4613 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -318,8 +318,7 @@ std::vector LoadPlugins() if (optsFunc != NULL) thisplugin.configopts = PluginConfig::GetConfigOptionVec(optsFunc()); - // afaik FreeLibrary should be fine because of ref counting, but it isn't. whatever. - // FreeLibrary(thisplugin.handle); + FreeLibrary(thisplugin.handle); outvec.push_back(thisplugin); } @@ -330,7 +329,8 @@ std::vector LoadPlugins() return outvec; } -std::vector AllPlugins = LoadPlugins(); +// don't load until actually needed to avoid loading disabled plugins +std::vector AllPlugins; // = LoadPlugins(); std::vector GetPluginOptions(std::vector* plugins) { @@ -344,7 +344,8 @@ std::vector GetPluginOptions(std::vector* plugins) return outvec; } -std::vector AllPluginOpts = GetPluginOptions(&AllPlugins); +// don't load until actually needed to avoid loading disabled plugins +std::vector AllPluginOpts; // = GetPluginOptions(&AllPlugins); // used to trick Optimus into switching to the NVIDIA GPU diff --git a/source-code/source/plugins/Launcher/ui.h b/source-code/source/plugins/Launcher/ui.h index f8a4c47..d49e2da 100644 --- a/source-code/source/plugins/Launcher/ui.h +++ b/source-code/source/plugins/Launcher/ui.h @@ -120,6 +120,9 @@ namespace Launcher { this->panel_Components->PerformLayout(); + AllPlugins = LoadPlugins(); + AllPluginOpts = GetPluginOptions(&AllPlugins); + this->panel_Plugins->SuspendLayout(); int pluginsY = 3;