Fix crash

Resolves: #1957754
This commit is contained in:
Ray Strode 2021-05-12 15:32:25 -04:00
parent 7da85e8b1e
commit 5dcafc6da2
2 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,109 @@
From 89b5facb7545c0423673c500343794a6c07fabfe Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 12 May 2021 15:19:26 -0400
Subject: [PATCH] input-sources-manager: Fail better if localed isn't available
At the moment we assumed the localed proxy will always return valid
strings. If localed exits, though, there's a small window where the
properties can return NULL.
This commit tries to handle that transient failure better.
---
compositor/kiosk-input-sources-manager.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/compositor/kiosk-input-sources-manager.c b/compositor/kiosk-input-sources-manager.c
index 7bb67b0..49973db 100644
--- a/compositor/kiosk-input-sources-manager.c
+++ b/compositor/kiosk-input-sources-manager.c
@@ -807,80 +807,87 @@ kiosk_input_sources_manager_add_layout (KioskInputSourcesManager *self,
g_debug ("KioskInputSourcesManager: Keyboard mapping full, starting another one");
input_source_group = kiosk_input_sources_manager_add_new_input_source_group (self, options);
kiosk_input_source_group_add_layout (input_source_group, xkb_layout, xkb_variant);
}
}
void
kiosk_input_sources_manager_add_input_engine (KioskInputSourcesManager *self,
const char *engine_name,
const char *options)
{
KioskInputSourceGroup *input_source_group = NULL;
g_debug ("KioskInputSourcesManager: Adding input engine '%s'", engine_name);
input_source_group = kiosk_input_sources_manager_add_new_input_source_group (self, options);
kiosk_input_source_group_set_input_engine (input_source_group, engine_name);
kiosk_input_source_group_set_options (input_source_group, options);
}
gboolean
kiosk_input_sources_manager_set_input_sources_from_system_configuration (KioskInputSourcesManager *self)
{
KioskInputSourceGroup *old_input_source_group;
g_autofree char *old_input_engine = NULL;
g_autofree char *old_selected_layout = NULL;
+ g_autofree char *localed_name_owner = NULL;
const char *layouts_string = NULL;
g_auto (GStrv) layouts = NULL;
size_t number_of_layouts = 0;
const char *variants_string = NULL;
g_auto (GStrv) variants = NULL;
size_t number_of_variants = 0;
const char *options = NULL;
size_t i, j;
gboolean input_source_group_active;
g_return_val_if_fail (KIOSK_IS_INPUT_SOURCES_MANAGER (self), FALSE);
if (self->locale_proxy == NULL) {
return FALSE;
}
+ localed_name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (self->locale_proxy));
+
+ if (localed_name_owner == NULL) {
+ return FALSE;
+ }
+
g_debug ("KioskInputSourcesManager: Setting keymap from system configuration");
layouts_string = sd_locale1_get_x11_layout (self->locale_proxy);
g_debug ("KioskInputSourcesManager: System layout is '%s'", layouts_string);
layouts = g_strsplit (layouts_string, ",", -1);
number_of_layouts = g_strv_length (layouts);
options = sd_locale1_get_x11_options (self->locale_proxy);
g_debug ("KioskInputSourcesManager: System layout options are '%s'", options);
variants_string = sd_locale1_get_x11_variant (self->locale_proxy);
g_debug ("KioskInputSourcesManager: System layout variant is '%s'", variants_string);
variants = g_strsplit (variants_string, ",", -1);
number_of_variants = g_strv_length (variants);
if (number_of_layouts < number_of_variants) {
g_debug ("KioskInputSourcesManager: There is a layout variant mismatch");
return FALSE;
}
old_input_source_group = kiosk_input_sources_manager_get_selected_input_source_group (self);
if (old_input_source_group != NULL) {
old_input_engine = g_strdup (kiosk_input_source_group_get_input_engine (old_input_source_group));
old_selected_layout = kiosk_input_source_group_get_selected_layout (old_input_source_group);
}
kiosk_input_sources_manager_clear_input_sources (self);
--
2.31.1

View File

@ -12,7 +12,7 @@
Name: gnome-kiosk
Version: 40~alpha
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Window management and application launching for GNOME
License: GPLv2+
@ -54,6 +54,9 @@ Patch30001: 0001-Make-the-desktop-file-valid.patch
# https://gitlab.gnome.org/halfline/gnome-kiosk/-/merge_requests/4
Patch40001: 0001-compositor-Put-the-on-top-windows-actually-on-top.patch
# https://gitlab.gnome.org/halfline/gnome-kiosk/-/merge_requests/5
Patch50001: 0001-input-sources-manager-Fail-better-if-localed-isn-t-a.patch
%description
GNOME Kiosk provides a desktop enviroment suitable for fixed purpose, or
single application deployments like wall displays and point-of-sale systems.
@ -96,6 +99,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.Kiosk.Searc
%{_datadir}/wayland-sessions/org.gnome.Kiosk.SearchApp.Session.desktop
%changelog
* Wed May 12 2021 Ray Strode <rstrode@redhat.com> - 40~alpha-9
- Fix crash
Resolves: #1957754
* Thu May 06 2021 Ray Strode <rstrode@redhat.com> - 40~alpha-8
- Fix window ordering bug
Resolves: #1957863