[clutter] gdk: Fix stage removal from the master clock



commit 505801cd095d2535dfbebf819d0ac9ec94522b2a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 23 13:22:18 2015 +0000

    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 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/clutter/gdk/clutter-master-clock-gdk.c b/clutter/gdk/clutter-master-clock-gdk.c
index f93e9ae..de6b966 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);
+        }
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]