master-clock: Take a reference before advancing timelines

A timeline advancement might cause another timeline to be
destroyed, which will likely lead to a segmentation fault.

Before advancing the timelines we should take a reference
on them - just like we do for the stages before doing
event processing. This will prevent dispose() from running
until the end of the advancement.

http://bugzilla.openedhand.com/show_bug.cgi?id=1854
This commit is contained in:
Emmanuele Bassi 2009-11-11 11:00:29 +00:00
parent 5ae88f5777
commit 1c69c61745

View File

@ -429,12 +429,19 @@ _clutter_master_clock_advance (ClutterMasterClock *master_clock)
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
/* we protect ourselves from timelines being removed during
* the advancement by other timelines
*/
g_slist_foreach (master_clock->timelines, (GFunc) g_object_ref, NULL);
for (l = master_clock->timelines; l != NULL; l = next)
{
next = l->next;
clutter_timeline_do_tick (l->data, &master_clock->cur_tick);
}
g_slist_foreach (master_clock->timelines, (GFunc) g_object_unref, NULL);
}
/**