ClutterDragAction: do not dereference a NULL priv->stage

When destroying an actor during a drag-action with a drag_handle, the
ClutterDragAction's priv->stage could be set to NULL in _set_actor().
_dispose() must not assume that priv->stage is not NULL.

See also https://bugzilla.gnome.org/show_bug.cgi?id=681814
This commit is contained in:
Alban Crequy 2013-04-29 14:59:20 +01:00
parent a0d9eaf15d
commit 2be42c333a

View File

@ -657,30 +657,38 @@ clutter_drag_action_dispose (GObject *gobject)
/* if we're being disposed while a capture is still present, we
* need to reset the state we are currently holding
*/
if (priv->last_motion_device != NULL)
if (priv->stage != NULL)
{
if (priv->last_motion_device != NULL)
{
_clutter_stage_remove_pointer_drag_actor (priv->stage,
priv->last_motion_device);
priv->last_motion_device = NULL;
}
if (priv->sequence != NULL)
{
_clutter_stage_remove_touch_drag_actor (priv->stage,
priv->sequence);
priv->sequence = NULL;
}
if (priv->capture_id != 0)
{
clutter_stage_set_motion_events_enabled (priv->stage,
priv->motion_events_enabled);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
}
}
else
{
_clutter_stage_remove_pointer_drag_actor (priv->stage,
priv->last_motion_device);
priv->last_motion_device = NULL;
}
if (priv->sequence != NULL)
{
_clutter_stage_remove_touch_drag_actor (priv->stage,
priv->sequence);
priv->sequence = NULL;
}
if (priv->capture_id != 0)
{
clutter_stage_set_motion_events_enabled (priv->stage,
priv->motion_events_enabled);
if (priv->stage != NULL)
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
}
if (priv->button_press_id != 0)