From 4c4605c50c4f8aff5e7441c71b6601d7a5184a53 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Wed, 9 Sep 2009 11:11:33 +0200 Subject: [PATCH] [AdgStroke] Disposing the subject AdgTrail Implemented the dispose() method to remove the weak dependency on the subject AdgTrail. --- adg/adg-stroke.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/adg/adg-stroke.c b/adg/adg-stroke.c index 449291ca..ed43af26 100644 --- a/adg/adg-stroke.c +++ b/adg/adg-stroke.c @@ -38,12 +38,15 @@ #include "adg-line-style.h" #include "adg-intl.h" +#define PARENT_OBJECT_CLASS ((GObjectClass *) adg_stroke_parent_class) + enum { PROP_0, PROP_TRAIL }; +static void dispose (GObject *object); static void get_property (GObject *object, guint param_id, GValue *value, @@ -74,6 +77,7 @@ adg_stroke_class_init(AdgStrokeClass *klass) g_type_class_add_private(klass, sizeof(AdgStrokePrivate)); + gobject_class->dispose = dispose; gobject_class->get_property = get_property; gobject_class->set_property = set_property; @@ -100,6 +104,15 @@ adg_stroke_init(AdgStroke *stroke) } static void +dispose(GObject *object) +{ + adg_stroke_set_trail((AdgStroke *) object, NULL); + + if (PARENT_OBJECT_CLASS->dispose != NULL) + PARENT_OBJECT_CLASS->dispose(object); +} + +static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { AdgStrokePrivate *data = ((AdgStroke *) object)->data; -- 2.11.4.GIT