From f2c9ef37632afcddbb5a68e18d41fc8d5e7626e0 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Wed, 21 Jul 2021 22:23:36 +0200 Subject: [PATCH] WindowServer: Reuse config variable from the class on theme change When changing the theme, there were two Core::ConfigFile instances (one class scoped -- m_config and one function scoped -- wm_config) fighting over the file, resulting in not saving the new theme name to the config. :^( This makes WindowServer remember selected theme from the menu after reboot! --- Userland/Services/WindowServer/WindowManager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 9f4fd5245f..5212baad15 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -1955,10 +1955,9 @@ bool WindowManager::update_theme(String theme_path, String theme_name) return false; Gfx::set_system_theme(new_theme); m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(new_theme); - auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini"); - wm_config->write_entry("Theme", "Name", theme_name); - wm_config->remove_entry("Background", "Color"); - wm_config->sync(); + m_config->write_entry("Theme", "Name", theme_name); + m_config->remove_entry("Background", "Color"); + m_config->sync(); invalidate_after_theme_or_font_change(); return true; }