37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
From 24a3b5e00c9d57472e5b06d59248df9fcecedc87 Mon Sep 17 00:00:00 2001
|
||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||
Date: Tue, 8 Oct 2024 10:36:03 +0800
|
||
Subject: [PATCH] fix(gnome): Fix crash caused by the previous commit due to
|
||
the existence of a schema but the absence of a color-schema
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
- 修复上次提交导致存在schema但是不存在color-scehma导致崩溃,加强对于schema以及key的判断
|
||
---
|
||
plugins/appearance/theme/appearance-theme.cpp | 8 +++++++-
|
||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||
|
||
diff --git a/plugins/appearance/theme/appearance-theme.cpp b/plugins/appearance/theme/appearance-theme.cpp
|
||
index 186e156..9f31ca5 100644
|
||
--- a/plugins/appearance/theme/appearance-theme.cpp
|
||
+++ b/plugins/appearance/theme/appearance-theme.cpp
|
||
@@ -53,7 +53,13 @@ AppearanceTheme::AppearanceTheme()
|
||
|
||
if (std::find(schemas.begin(), schemas.end(), GNOME_DESKTOP_SCHEMA_ID) != schemas.end())
|
||
{
|
||
- this->gnome_desktop_settigns_ = Gio::Settings::create(GNOME_DESKTOP_SCHEMA_ID);
|
||
+ auto temp_settings = Gio::Settings::create(GNOME_DESKTOP_SCHEMA_ID);
|
||
+ auto keys = temp_settings->list_keys();
|
||
+ if ( std::find(keys.begin(), keys.end(), GNOME_DESKTOP_SCHEMA_KEY_COLOR_SCHEMA) != keys.end() )
|
||
+ {
|
||
+ // 确保 org.gnome.desktop.interface color-scheme 完全存在才使用
|
||
+ this->gnome_desktop_settigns_ = temp_settings;
|
||
+ }
|
||
}
|
||
}
|
||
|
||
--
|
||
2.27.0
|
||
|