[Workman-devel] [PATCH] WorkmanObject: set object ptr to NULL in dispose
Josh Poimboeuf
jpoimboe at redhat.com
Thu Mar 7 14:48:49 UTC 2013
In WorkmanObject, the dispose() method can be called more than once, so
set the object pointer to NULL after unreferencing the object.
Technically, the unref could be moved to finalize, but it's safer to
leave it in dispose in case WorkmanAttribute ever changed to store a
reference to WorkmanObject.
---
workman/workman-object.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/workman/workman-object.c b/workman/workman-object.c
index b89d73d..8d6740c 100644
--- a/workman/workman-object.c
+++ b/workman/workman-object.c
@@ -103,6 +103,7 @@ workman_object_dispose(GObject *object)
WorkmanObject *self = WORKMAN_OBJECT(object);
g_boxed_free(WORKMAN_TYPE_ATTRIBUTE_LIST, self->priv->attributes);
+ self->priv->attributes = NULL;
G_OBJECT_CLASS(workman_object_parent_class)->dispose(object);
}
--
1.7.11.7
More information about the Workman-devel
mailing list