ClutterActor: clear redraw entry before emitting signals

If the redraw entry is not cleared, queueing a redraw from a signal
handler could reinsert the same object in the stage redraw list,
causing the segfault later (as the object is immediately freed)

https://bugzilla.gnome.org/show_bug.cgi?id=671173
This commit is contained in:
Giovanni Campagna 2012-03-01 22:58:39 +01:00
parent 251d3b545e
commit 018ede2b24

View File

@ -6537,6 +6537,14 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *pv; ClutterPaintVolume *pv;
gboolean clipped; gboolean clipped;
/* Remove queue entry early in the process, otherwise a new
queue_redraw() during signal handling could put back this
object in the stage redraw list (but the entry is freed as
soon as we return from this function, causing a segfault
later)
*/
priv->queue_redraw_entry = NULL;
/* If we've been explicitly passed a clip volume then there's /* If we've been explicitly passed a clip volume then there's
* nothing more to calculate, but otherwise the only thing we know * nothing more to calculate, but otherwise the only thing we know
* is that the change is constrained to the given actor. * is that the change is constrained to the given actor.
@ -6595,8 +6603,6 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
*/ */
if (G_LIKELY (clipped)) if (G_LIKELY (clipped))
_clutter_actor_set_queue_redraw_clip (self, NULL); _clutter_actor_set_queue_redraw_clip (self, NULL);
priv->queue_redraw_entry = NULL;
} }
static void static void