[gnome-initial-setup/gnome-3-36] keyboard: Fix use of uninitialised variables if localed properties unset
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/gnome-3-36] keyboard: Fix use of uninitialised variables if localed properties unset
- Date: Wed, 15 Apr 2020 14:45:59 +0000 (UTC)
commit ee2b4147d3145e94c76d8f9074bb09d1e4d3f0a0
Author: Philip Withnall <withnall endlessm com>
Date: Wed Apr 15 14:53:03 2020 +0100
keyboard: Fix use of uninitialised variables if localed properties unset
If localed returns a `NULL` list of sources, the code which was
introduced in commit 07e24d6f would go ahead and dereference the `id`
and `type` variables which hadn’t yet been set.
From reading the comment in `preselect_input_source()`, it looks like
the intention was to prefer the `system_sources` over the data returned
by `gnome_get_input_source_from_locale()` — if both were set. The code
didn’t properly handle the situation where either or both of them were
unset, though.
Signed-off-by: Philip Withnall <withnall endlessm com>
(cherry picked from commit e5563bcce1123e5d079b7d5969f3be4013af2815)
gnome-initial-setup/pages/keyboard/gis-keyboard-page.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
index a49e7b5..fc139ee 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
@@ -374,14 +374,14 @@ preselect_input_source (GisKeyboardPage *self)
* add both system keyboard layout and the ibus input method. */
language = cc_common_language_get_current_language ();
- if (!priv->system_sources ||
- (gnome_get_input_source_from_locale (language, &type, &id) && g_strcmp0 (type, "xkb") != 0)) {
- cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser),
- id, type);
- } else {
+ if (priv->system_sources) {
cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser),
(const gchar *) priv->system_sources->data,
"xkb");
+ } else if (gnome_get_input_source_from_locale (language, &type, &id) &&
+ g_strcmp0 (type, "xkb") != 0) {
+ cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser),
+ id, type);
}
g_free (language);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]