[clutter] ClutterDragAction: do not dereference a NULL priv->stage
- From: Alban Crequy <albanc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] ClutterDragAction: do not dereference a NULL priv->stage
- Date: Tue, 30 Apr 2013 16:42:47 +0000 (UTC)
commit 2be42c333ae621df085005e08b7c5c08c02dcbe5
Author: Alban Crequy <alban crequy collabora co uk>
Date: Mon Apr 29 14:59:20 2013 +0100
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
clutter/clutter-drag-action.c | 44 ++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/clutter/clutter-drag-action.c b/clutter/clutter-drag-action.c
index 7e1a600..3d3ff57 100644
--- a/clutter/clutter-drag-action.c
+++ b/clutter/clutter-drag-action.c
@@ -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)
{
- _clutter_stage_remove_pointer_drag_actor (priv->stage,
- priv->last_motion_device);
- priv->last_motion_device = 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->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->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);
+ g_signal_handler_disconnect (priv->stage, priv->capture_id);
+ priv->capture_id = 0;
+ priv->stage = NULL;
+ }
+ }
+ else
+ {
+ priv->last_motion_device = NULL;
+ priv->sequence = NULL;
priv->capture_id = 0;
- priv->stage = NULL;
}
if (priv->button_press_id != 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]