[gst-cvs] gstreamer: clock: fix racy shutdown clock id leak

Sebastian Dröge slomo at kemper.freedesktop.org
Thu Sep 23 12:54:08 PDT 2010


Module: gstreamer
Branch: master
Commit: a95eacb56a5f6c4734ee232722f533fdfd9f5911
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=a95eacb56a5f6c4734ee232722f533fdfd9f5911

Author: Trond Andersen <trond.andersen at tandberg.com>
Date:   Tue Jan 12 17:10:59 2010 +0100

clock: fix racy shutdown clock id leak

Clock IDs were leaked if the clock got disposed before the worker thread
got a chance to reap unscheduled entries.

Fixes bug #630439.

---

 gst/gstsystemclock.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gst/gstsystemclock.c b/gst/gstsystemclock.c
index 87fb4d7..6b31bab 100644
--- a/gst/gstsystemclock.c
+++ b/gst/gstsystemclock.c
@@ -198,8 +198,6 @@ gst_system_clock_dispose (GObject * object)
     GST_CAT_DEBUG (GST_CAT_CLOCK, "unscheduling entry %p", entry);
     entry->status = GST_CLOCK_UNSCHEDULED;
   }
-  g_list_free (clock->entries);
-  clock->entries = NULL;
   GST_CLOCK_BROADCAST (clock);
   gst_system_clock_add_wakeup (sysclock);
   GST_OBJECT_UNLOCK (clock);
@@ -209,6 +207,10 @@ gst_system_clock_dispose (GObject * object)
   sysclock->thread = NULL;
   GST_CAT_DEBUG (GST_CAT_CLOCK, "joined thread");
 
+  g_list_foreach (clock->entries, (GFunc) gst_clock_id_unref, NULL);
+  g_list_free (clock->entries);
+  clock->entries = NULL;
+
   gst_poll_free (sysclock->priv->timer);
 
   G_OBJECT_CLASS (parent_class)->dispose (object);





More information about the Gstreamer-commits mailing list