gdk: Fix stage removal from the master clock

Prevents a double-free in the conformance test suite.
This commit is contained in:
Emmanuele Bassi 2015-03-23 13:22:18 +00:00
parent 83edd9c4c5
commit 505801cd09

View File

@ -304,14 +304,20 @@ clutter_master_clock_gdk_remove_stage_clock (ClutterMasterClockGdk *master_clock
stages = g_hash_table_lookup (master_clock->clock_to_stage, frame_clock); stages = g_hash_table_lookup (master_clock->clock_to_stage, frame_clock);
if (stages != NULL) if (stages != NULL)
{ {
stages = g_list_remove (stages, stage); if (stages->next == NULL)
if (stages == NULL)
{ {
g_signal_handlers_disconnect_by_func (frame_clock, g_signal_handlers_disconnect_by_func (frame_clock,
clutter_master_clock_gdk_update, clutter_master_clock_gdk_update,
master_clock); master_clock);
g_hash_table_remove (master_clock->clock_to_stage, frame_clock); g_hash_table_remove (master_clock->clock_to_stage, frame_clock);
} }
else
{
stages = g_list_remove (stages, stage);
g_hash_table_replace (master_clock->clock_to_stage,
g_object_ref (frame_clock),
stages);
}
} }
} }