[gnome-control-center/gnome-3-10] keyboard: Fix a crash if the WM changes (or restarts)



commit 63aabd81500dd6530f4d002cf1cacaac76cf0d99
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Sep 5 12:49:41 2014 +0200

    keyboard: Fix a crash if the WM changes (or restarts)
    
    By stopping watching for WM changes when leaving the shortcuts panel.
    
     #0 reload_sections
     #1 wm_window_event_filter
     #2 gdk_event_apply_filters at gdkeventsource.c:81
     #3 gdk_event_source_translate_event at gdkeventsource.c:195
     #4 _gdk_x11_display_queue_events at gdkeventsource.c:338
     #5 gdk_display_get_event at gdkdisplay.c:313
     #10 g_main_context_iteration at gmain.c:3766
     #11 g_application_run at gapplication.c:1623
    
    See https://bugzilla.redhat.com/show_bug.cgi?id=1094480
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736117
    
    Conflicts:
        panels/keyboard/keyboard-shortcuts.c

 panels/keyboard/keyboard-shortcuts.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index ddaf588..2f158b0 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -87,6 +87,7 @@ static GtkWidget *custom_shortcut_command_entry = NULL;
 static GHashTable *kb_system_sections = NULL;
 static GHashTable *kb_apps_sections = NULL;
 static GHashTable *kb_user_sections = NULL;
+static gpointer wm_changed_id = NULL;
 
 static void
 free_key_array (GPtrArray *keys)
@@ -1843,8 +1844,8 @@ void
 keyboard_shortcuts_init (CcPanel *panel, GtkBuilder *builder)
 {
   g_object_set_data (G_OBJECT (panel), "builder", builder);
-  wm_common_register_window_manager_change ((GFunc) on_window_manager_change,
-                                            panel);
+  wm_changed_id = wm_common_register_window_manager_change ((GFunc) on_window_manager_change,
+                                                            panel);
   pictures_regex = g_regex_new ("\\$PICTURES", 0, 0, NULL);
   setup_dialog (panel, builder);
   reload_sections (panel);
@@ -1928,5 +1929,11 @@ keyboard_shortcuts_dispose (CcPanel *panel)
 
   g_clear_pointer (&custom_shortcut_dialog, gtk_widget_destroy);
 
+  if (wm_changed_id)
+    {
+      wm_common_unregister_window_manager_change (wm_changed_id);
+      wm_changed_id = NULL;
+    }
+
   cc_keyboard_option_clear_all ();
 }


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