[gnome-control-center] wacom: Workaround deadlocks in Clutter event handlers



commit c0e854a6dde6592a525c3423bb4b56d28ba74c5d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jan 22 21:51:46 2016 +0100

    wacom: Workaround deadlocks in Clutter event handlers
    
    The way we destroy the window during the handling of a clutter event may
    cause the window to generate a focus event that gets processed immediately,
    causing Clutter to deadlock on its global lock.
    
    Bypass these issues in the places where we finalize out of Clutter events,
    The Esc key presses are now handled at the GTK+ level, and we postpone
    finalization (with either success or failure) to an idle.
    
    Works around https://bugzilla.gnome.org/show_bug.cgi?id=747880

 panels/wacom/calibrator/calibrator-gui.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/panels/wacom/calibrator/calibrator-gui.c b/panels/wacom/calibrator/calibrator-gui.c
index 214c886..b58dfdc 100644
--- a/panels/wacom/calibrator/calibrator-gui.c
+++ b/panels/wacom/calibrator/calibrator-gui.c
@@ -175,7 +175,7 @@ on_delete_event (GtkWidget *widget,
 }
 
 static gboolean
-draw_success_end_wait_callback (CalibArea *area)
+calib_area_finish_idle_cb (CalibArea *area)
 {
   calib_area_notify_finish (area);
   return FALSE;
@@ -245,12 +245,12 @@ set_calibration_status (CalibArea *area)
     {
       set_success (area);
       g_timeout_add (END_TIME,
-                     (GSourceFunc) draw_success_end_wait_callback,
+                     (GSourceFunc) calib_area_finish_idle_cb,
                      area);
     }
   else
     {
-      calib_area_notify_finish (area);
+      g_idle_add ((GSourceFunc) calib_area_finish_idle_cb, area);
     }
 }
 
@@ -376,19 +376,16 @@ on_button_press_event(ClutterActor       *actor,
 }
 
 static gboolean
-on_key_release_event(ClutterActor    *actor,
-                     ClutterKeyEvent *event,
-                     CalibArea       *area)
+on_key_release_event (GtkWidget   *widget,
+                      GdkEventKey *event,
+                      CalibArea   *area)
 {
   if (area->success ||
-      event->type != CLUTTER_KEY_RELEASE ||
-      event->keyval != CLUTTER_KEY_Escape)
-    {
-      return FALSE;
-    }
+      event->keyval != GDK_KEY_Escape)
+    return GDK_EVENT_PROPAGATE;
 
   calib_area_notify_finish (area);
-  return FALSE;
+  return GDK_EVENT_STOP;
 }
 
 static gboolean
@@ -669,10 +666,6 @@ set_up_stage (CalibArea *calib_area, ClutterActor *stage)
                     "button-press-event",
                     G_CALLBACK (on_button_press_event),
                     calib_area);
-  g_signal_connect (stage,
-                    "key-release-event",
-                    G_CALLBACK (on_key_release_event),
-                    calib_area);
 }
 
 /**
@@ -756,6 +749,10 @@ calib_area_new (GdkScreen      *screen,
   set_up_stage (calib_area, stage);
 
   g_signal_connect (calib_area->window,
+                    "key-release-event",
+                    G_CALLBACK (on_key_release_event),
+                    calib_area);
+  g_signal_connect (calib_area->window,
                     "delete-event",
                     G_CALLBACK (on_delete_event),
                     calib_area);


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