[gnome-initial-setup: 1/3] keyboard: Nullify pointers if getting layout fails
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup: 1/3] keyboard: Nullify pointers if getting layout fails
- Date: Wed, 15 Apr 2020 14:01:15 +0000 (UTC)
commit 954e0b150f5abe9b921a4bfc03f7607910e3e905
Author: Philip Withnall <withnall endlessm com>
Date: Tue Apr 14 16:39:51 2020 +0100
keyboard: Nullify pointers if getting layout fails
It’s possible for `get_layout()` to fail if the wrong type is specified,
in which case the `layout` and `variant` pointers will be left dangling.
This might fix an occasional bug where the keyboard layout isn’t saved
correctly and warnings are spewed to the console about
```
g_variant_new_string: assertion 'g_utf8_validate (string, -1, NULL)' failed
```
Or it might not. I haven’t been able to reproduce that bug.
Signed-off-by: Philip Withnall <withnall endlessm com>
gnome-initial-setup/pages/keyboard/cc-input-chooser.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
index 07a1122..196abf6 100644
--- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
+++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
@@ -886,7 +886,12 @@ cc_input_chooser_get_layout (CcInputChooser *chooser,
{
CcInputChooserPrivate *priv = cc_input_chooser_get_instance_private (chooser);
- get_layout (chooser, priv->type, priv->id, layout, variant);
+ if (!get_layout (chooser, priv->type, priv->id, layout, variant)) {
+ if (layout != NULL)
+ *layout = NULL;
+ if (variant != NULL)
+ *variant = NULL;
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]