From 505801cd095d2535dfbebf819d0ac9ec94522b2a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 23 Mar 2015 13:22:18 +0000 Subject: [PATCH] gdk: Fix stage removal from the master clock Prevents a double-free in the conformance test suite. --- clutter/gdk/clutter-master-clock-gdk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clutter/gdk/clutter-master-clock-gdk.c b/clutter/gdk/clutter-master-clock-gdk.c index f93e9aec1..de6b966c8 100644 --- a/clutter/gdk/clutter-master-clock-gdk.c +++ b/clutter/gdk/clutter-master-clock-gdk.c @@ -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); if (stages != NULL) { - stages = g_list_remove (stages, stage); - if (stages == NULL) + if (stages->next == NULL) { g_signal_handlers_disconnect_by_func (frame_clock, clutter_master_clock_gdk_update, master_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); + } } }