[rygel] core: Use destroyer instead of keeping a weak_ref



commit 9e35f947248fb0c25b503ab605c20cd031d90734
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jul 30 03:26:15 2009 +0300

    core: Use destroyer instead of keeping a weak_ref
    
    Keep a pointer to description document and delete it on destruction of
    the associated RootDevice instead of using weak_ref.

 src/rygel/rygel-root-device.vala |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-root-device.vala b/src/rygel/rygel-root-device.vala
index 78812ce..b36dc4f 100644
--- a/src/rygel/rygel-root-device.vala
+++ b/src/rygel/rygel-root-device.vala
@@ -31,6 +31,8 @@ using Gee;
 public class Rygel.RootDevice: GUPnP.RootDevice {
     internal ArrayList<ServiceInfo> services;   /* Services we implement */
 
+    private Xml.Doc *desc_doc;
+
     public RootDevice (GUPnP.Context context,
                        Plugin        plugin,
                        Xml.Doc      *description_doc,
@@ -41,10 +43,10 @@ public class Rygel.RootDevice: GUPnP.RootDevice {
         this.context = context;
 
         this.description_doc = description_doc;
-        this.weak_ref ((WeakNotify) xml_doc_free, description_doc);
         this.description_path = description_path;
         this.description_dir = description_dir;
 
+        this.desc_doc = description_doc;
         this.services = new ArrayList<ServiceInfo> ();
 
         // Now create the sevice objects
@@ -58,9 +60,8 @@ public class Rygel.RootDevice: GUPnP.RootDevice {
         }
     }
 
-    private static void xml_doc_free (Xml.Doc*         doc,
-                                      Rygel.RootDevice device) {
-        delete doc;
+    ~RootDevice () {
+        delete this.desc_doc;
     }
 }
 



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