core: Explicitly remove bus watch
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 8 Apr 2011 18:50:14 +0000 (21:50 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 8 Apr 2011 19:10:29 +0000 (22:10 +0300)
We need to do this to break cyclic reference between HTTPGstResponse,
GstPipeline and GstBus.

src/rygel/rygel-http-gst-response.vala

index df48838..5ef6539 100644 (file)
@@ -27,6 +27,7 @@ using Soup;
 
 internal class Rygel.HTTPGstResponse : Rygel.HTTPResponse {
     private Pipeline pipeline;
+    private uint bus_watch_id;
 
     public HTTPSeek seek;
 
@@ -66,6 +67,7 @@ internal class Rygel.HTTPGstResponse : Rygel.HTTPResponse {
         sink.cancellable.cancel ();
 
         this.pipeline.set_state (State.NULL);
+        Source.remove (this.bus_watch_id);
 
         var encoding = this.msg.response_headers.get_encoding ();
 
@@ -100,7 +102,7 @@ internal class Rygel.HTTPGstResponse : Rygel.HTTPResponse {
 
         // Bus handler
         var bus = this.pipeline.get_bus ();
-        bus.add_watch (bus_handler);
+        this.bus_watch_id = bus.add_watch (this.bus_handler);
     }
 
     private void src_pad_added (Element src,