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



commit 439eb22ca13320a5b50923d2ea9021c669723957
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

 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 4dfd573..4514370 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -95,6 +95,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)
@@ -2066,8 +2067,8 @@ keyboard_shortcuts_init (CcPanel *panel, GtkBuilder *builder)
   g_object_set_data (G_OBJECT (panel), "builder", builder);
 #ifdef GDK_WINDOWING_X11
   if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
-    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);
 #endif
   pictures_regex = g_regex_new ("\\$PICTURES", 0, 0, NULL);
   setup_dialog (panel, builder);
@@ -2152,5 +2153,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]