43 lines
1.8 KiB
Diff
43 lines
1.8 KiB
Diff
From 269cf451feb18206f9a8326d8fa36bc36f9b1897 Mon Sep 17 00:00:00 2001
|
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
Date: Wed, 19 Mar 2025 14:41:15 +0100
|
|
Subject: [PATCH] input-sources-manager: Do not crash if there is no X11Layouts
|
|
|
|
When queried for the X11Layout property, localed will try to get the
|
|
configuration from /etc/X11/xorg.conf.d/00-keyboard.conf.
|
|
|
|
If for some reason (the system was misconfigured or the installation was
|
|
altered), that directory is not accessible or not present, localed will
|
|
return a NULL string instead of the actual X11 layouts or even an empty
|
|
string if no X11 layout was ever configured.
|
|
|
|
In such a case, gnome-kiosk will segfault.
|
|
|
|
To avoid that potential problem, check for the X11 layouts to be not
|
|
NULL or return early if that's not the case.
|
|
|
|
Fixes: 38407233 - input-sources-manager: Add APIs for setting keymap
|
|
Part-of: <https://gitlab.gnome.org/GNOME/gnome-kiosk/-/merge_requests/68>
|
|
---
|
|
compositor/kiosk-input-sources-manager.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/compositor/kiosk-input-sources-manager.c b/compositor/kiosk-input-sources-manager.c
|
|
index 31dab12..6200af5 100644
|
|
--- a/compositor/kiosk-input-sources-manager.c
|
|
+++ b/compositor/kiosk-input-sources-manager.c
|
|
@@ -869,6 +869,10 @@ kiosk_input_sources_manager_set_input_sources_from_system_configuration (KioskIn
|
|
g_debug ("KioskInputSourcesManager: Setting keymap from system configuration");
|
|
|
|
layouts_string = sd_locale1_get_x11_layout (self->locale_proxy);
|
|
+ if (layouts_string == NULL) {
|
|
+ g_debug ("KioskInputSourcesManager: No layouts defined");
|
|
+ return FALSE;
|
|
+ }
|
|
g_debug ("KioskInputSourcesManager: System layout is '%s'", layouts_string);
|
|
|
|
layouts = g_strsplit (layouts_string, ",", -1);
|
|
--
|
|
2.49.0
|
|
|