UICommon: Merge ConfigChangedCallbacks

Use a single lambda as a callback which calls InitCustomPaths and
RefreshConfig instead of having separate callbacks for each of them.

This fixes the callback for InitCustomPaths not being removed on
shutdown; the callback for the lambda (previously for RefreshConfig) is
already removed in Shutdown().
This commit is contained in:
Dentomologist 2025-04-25 12:05:35 -07:00
parent 8724daf44e
commit 9db4067957

View file

@ -130,14 +130,17 @@ void Init()
Core::RestoreWiiSettings(Core::RestoreReason::CrashRecovery); Core::RestoreWiiSettings(Core::RestoreReason::CrashRecovery);
Config::Init(); Config::Init();
Config::AddConfigChangedCallback(InitCustomPaths); const auto config_changed_callback = []() {
InitCustomPaths();
RefreshConfig();
};
s_config_changed_callback_id = Config::AddConfigChangedCallback(config_changed_callback);
Config::AddLayer(ConfigLoaders::GenerateBaseConfigLoader()); Config::AddLayer(ConfigLoaders::GenerateBaseConfigLoader());
SConfig::Init(); SConfig::Init();
Discord::Init(); Discord::Init();
Common::Log::LogManager::Init(); Common::Log::LogManager::Init();
VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND)); VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
s_config_changed_callback_id = Config::AddConfigChangedCallback(RefreshConfig);
RefreshConfig(); RefreshConfig();
} }