From 9e35f947248fb0c25b503ab605c20cd031d90734 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Thu, 30 Jul 2009 03:26:15 +0300 Subject: [PATCH] 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 file 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 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 (); // 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; } } -- 2.7.4