[clutter] fix crash when destroying an actor during a drag-action with a drag_handle



commit a0d9eaf15da5d2227bc95c6946fca5ed356fdfdb
Author: Alban Crequy <alban crequy collabora co uk>
Date:   Fri Apr 26 15:26:48 2013 +0100

    fix crash when destroying an actor during a drag-action with a drag_handle
    
    Bug introduced by commit 59801ef8 (drag-action: fix press coords transform
    with drag_handle) for bgo#681746.
    
    See also https://bugzilla.gnome.org/show_bug.cgi?id=681814

 clutter/clutter-drag-action.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/clutter/clutter-drag-action.c b/clutter/clutter-drag-action.c
index ef2ab0d..7e1a600 100644
--- a/clutter/clutter-drag-action.c
+++ b/clutter/clutter-drag-action.c
@@ -1139,16 +1139,19 @@ clutter_drag_action_set_drag_handle (ClutterDragAction *action,
 
   priv->drag_handle = handle;
 
-  priv->transformed_press_x = priv->press_x;
-  priv->transformed_press_y = priv->press_y;
-  clutter_actor_transform_stage_point (handle, priv->press_x, priv->press_y,
-                                       &priv->transformed_press_x,
-                                       &priv->transformed_press_y);
-
   if (priv->drag_handle != NULL)
-    g_signal_connect (priv->drag_handle, "destroy",
-                      G_CALLBACK (on_drag_handle_destroy),
-                      action);
+    {
+      priv->transformed_press_x = priv->press_x;
+      priv->transformed_press_y = priv->press_y;
+      clutter_actor_transform_stage_point (priv->drag_handle, priv->press_x,
+                                           priv->press_y,
+                                           &priv->transformed_press_x,
+                                           &priv->transformed_press_y);
+
+      g_signal_connect (priv->drag_handle, "destroy",
+                        G_CALLBACK (on_drag_handle_destroy),
+                        action);
+    }
 
   g_object_notify_by_pspec (G_OBJECT (action), drag_props[PROP_DRAG_HANDLE]);
 }


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