[clutter/clutter-1.6] Add some safety nets for NULL values
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.6] Add some safety nets for NULL values
- Date: Mon, 22 Aug 2011 10:09:07 +0000 (UTC)
commit 5ba7c13f676738225bf92cc8c587ba9319960c56
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Jun 8 14:25:50 2011 +0100
Add some safety nets for NULL values
https://bugzilla.gnome.org/show_bug.cgi?id=652034
clutter/clutter-actor.c | 7 +++++--
clutter/clutter-stage.c | 31 ++++++++++++++++---------------
2 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 6d0f1b3..23ef9b8 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -4950,7 +4950,7 @@ clutter_actor_destroy (ClutterActor *self)
}
void
-_clutter_actor_finish_queue_redraw (ClutterActor *self,
+_clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip)
{
ClutterActorPrivate *priv = self->priv;
@@ -4986,6 +4986,9 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterActorBox *box = &priv->last_paint_box;
ClutterVertex origin;
+ if (stage == NULL)
+ return;
+
_clutter_paint_volume_init_static (stage, &stage_pv);
origin.x = box->x1;
@@ -5136,7 +5139,7 @@ clutter_actor_queue_redraw (ClutterActor *self)
}
static void
-_clutter_actor_get_allocation_clip (ClutterActor *self,
+_clutter_actor_get_allocation_clip (ClutterActor *self,
ClutterActorBox *clip)
{
ClutterActorBox allocation;
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index bc388b5..5e0ca5b 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -3249,10 +3249,10 @@ _clutter_stage_get_clip (ClutterStage *stage)
* didn't explicitly do so.
*/
ClutterStageQueueRedrawEntry *
-_clutter_stage_queue_actor_redraw (ClutterStage *stage,
+_clutter_stage_queue_actor_redraw (ClutterStage *stage,
ClutterStageQueueRedrawEntry *entry,
- ClutterActor *actor,
- ClutterPaintVolume *clip)
+ ClutterActor *actor,
+ ClutterPaintVolume *clip)
{
ClutterStagePrivate *priv = stage->priv;
@@ -3287,7 +3287,7 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
*/
_clutter_stage_set_pick_buffer_valid (stage, FALSE, -1);
- if (entry)
+ if (entry != NULL)
{
/* Ignore all requests to queue a redraw for an actor if a full
* (non-clipped) redraw of the actor has already been queued. */
@@ -3304,26 +3304,27 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
clutter_paint_volume_free (&entry->clip);
entry->has_clip = FALSE;
}
+
return entry;
}
else
{
- entry = g_slice_new (ClutterStageQueueRedrawEntry);
- entry->actor = g_object_ref (actor);
+ ClutterStageQueueRedrawEntry *new_entry;
- if (clip)
+ new_entry = g_slice_new0 (ClutterStageQueueRedrawEntry);
+ new_entry->actor = g_object_ref (actor);
+
+ if (clip != NULL)
{
- entry->has_clip = TRUE;
- _clutter_paint_volume_init_static (actor, &entry->clip);
- _clutter_paint_volume_set_from_volume (&entry->clip, clip);
+ new_entry->has_clip = TRUE;
+ _clutter_paint_volume_init_static (actor, &new_entry->clip);
+ _clutter_paint_volume_set_from_volume (&new_entry->clip, clip);
}
- else
- entry->has_clip = FALSE;
- stage->priv->pending_queue_redraws =
- g_list_prepend (stage->priv->pending_queue_redraws, entry);
+ priv->pending_queue_redraws =
+ g_list_prepend (priv->pending_queue_redraws, new_entry);
- return entry;
+ return new_entry;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]