[gnome-control-center] keyboard: Avoid segfault due to no "data" for `custom_shortcut_add_row`



commit fbadba1a1877258bcb7be404a052e32e53f89bfe
Author: Ian Douglas Scott <idscott system76 com>
Date:   Wed Dec 1 12:15:45 2021 -0800

    keyboard: Avoid segfault due to no "data" for `custom_shortcut_add_row`
    
    Ultimately it would be good to get rid of the use of
    `g_object_set_data`/`g_object_get_data` here, but this works for now.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1373.

 panels/keyboard/cc-keyboard-shortcut-dialog.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/panels/keyboard/cc-keyboard-shortcut-dialog.c b/panels/keyboard/cc-keyboard-shortcut-dialog.c
index 0d07b5f15..15f3dfd51 100644
--- a/panels/keyboard/cc-keyboard-shortcut-dialog.c
+++ b/panels/keyboard/cc-keyboard-shortcut-dialog.c
@@ -235,7 +235,7 @@ remove_item (CcKeyboardShortcutDialog *self,
 
       row_data = g_object_get_data (G_OBJECT (child), "data");
 
-      if (row_data->item == item)
+      if (row_data && row_data->item == item)
         {
           if (strcmp (row_data->section_id, "custom") == 0)
             {
@@ -411,6 +411,9 @@ reset_shortcut (CcKeyboardShortcutDialog *self,
 {
   ShortcutRowData *data;
 
+  if (row == GTK_WIDGET (self->custom_shortcut_add_row))
+    return;
+
   data = g_object_get_data (G_OBJECT (row), "data");
 
   /* Don't reset custom shortcuts */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]