summaryrefslogtreecommitdiffstats
path: root/libdimension/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/object.c')
-rw-r--r--libdimension/object.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libdimension/object.c b/libdimension/object.c
index 7c4a714..f73ea02 100644
--- a/libdimension/object.c
+++ b/libdimension/object.c
@@ -39,6 +39,7 @@ dmnsn_new_object(void)
object->inside_fn = NULL;
object->initialize_fn = NULL;
object->free_fn = NULL;
+ object->refcount = dmnsn_new_refcount();
return object;
}
@@ -46,7 +47,8 @@ dmnsn_new_object(void)
void
dmnsn_delete_object(dmnsn_object *object)
{
- if (object) {
+ if (object && DMNSN_DECREF(object)) {
+ dmnsn_delete_refcount(object->refcount);
DMNSN_ARRAY_FOREACH (dmnsn_object **, child, object->children) {
dmnsn_delete_object(*child);
}