mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
drag-action: Remove the drag handle on destruction
When the drag handle actor is destroyed we should unset the field inside the DragAction, to avoid having stale pointers lying around. https://bugzilla.gnome.org/show_bug.cgi?id=652842
This commit is contained in:
parent
0dea846096
commit
a6a57d7967
@ -516,6 +516,8 @@ clutter_drag_action_dispose (GObject *gobject)
|
|||||||
priv->button_press_id = 0;
|
priv->button_press_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clutter_drag_action_set_drag_handle (CLUTTER_DRAG_ACTION (gobject), NULL);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_drag_action_parent_class)->dispose (gobject);
|
G_OBJECT_CLASS (clutter_drag_action_parent_class)->dispose (gobject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,12 +839,19 @@ clutter_drag_action_get_drag_threshold (ClutterDragAction *action,
|
|||||||
*y_threshold = y_res;
|
*y_threshold = y_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_drag_handle_destroy (ClutterActor *actor,
|
||||||
|
ClutterDragAction *action)
|
||||||
|
{
|
||||||
|
action->priv->drag_handle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_drag_action_set_drag_handle:
|
* clutter_drag_action_set_drag_handle:
|
||||||
* @action: a #ClutterDragAction
|
* @action: a #ClutterDragAction
|
||||||
* @handle: a #ClutterActor
|
* @handle: (allow-none): a #ClutterActor, or %NULL to unset
|
||||||
*
|
*
|
||||||
* Sets the actor to be used as the drag handle
|
* Sets the actor to be used as the drag handle.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
@ -853,15 +862,25 @@ clutter_drag_action_set_drag_handle (ClutterDragAction *action,
|
|||||||
ClutterDragActionPrivate *priv;
|
ClutterDragActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_DRAG_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_DRAG_ACTION (action));
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (handle));
|
g_return_if_fail (handle == NULL || CLUTTER_IS_ACTOR (handle));
|
||||||
|
|
||||||
priv = action->priv;
|
priv = action->priv;
|
||||||
|
|
||||||
if (priv->drag_handle == handle)
|
if (priv->drag_handle == handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (priv->drag_handle != NULL)
|
||||||
|
g_signal_handlers_disconnect_by_func (priv->drag_handle,
|
||||||
|
G_CALLBACK (on_drag_handle_destroy),
|
||||||
|
action);
|
||||||
|
|
||||||
priv->drag_handle = handle;
|
priv->drag_handle = handle;
|
||||||
|
|
||||||
|
if (priv->drag_handle != NULL)
|
||||||
|
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]);
|
g_object_notify_by_pspec (G_OBJECT (action), drag_props[PROP_DRAG_HANDLE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user