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



commit 7b0c55bfc5c88dda52e3a5452aad1ebbdbffe0e8
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 0814ead4f..db214dca9 100644
--- a/panels/keyboard/cc-keyboard-shortcut-dialog.c
+++ b/panels/keyboard/cc-keyboard-shortcut-dialog.c
@@ -234,7 +234,7 @@ remove_item (CcKeyboardShortcutDialog *self,
 
       row_data = g_object_get_data (l->data, "data");
 
-      if (row_data->item == item)
+      if (row_data && row_data->item == item)
         {
           if (strcmp (row_data->section_id, "custom") == 0)
             {
@@ -403,6 +403,9 @@ reset_all_shortcuts_cb (GtkWidget *widget,
 
   self = user_data;
 
+  if (widget == GTK_WIDGET (self->custom_shortcut_add_row))
+    return;
+
   data = g_object_get_data (G_OBJECT (widget), "data");
 
   /* Don't reset custom shortcuts */


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