From 7cd86508a3ce012600f6949e98e30e2faa038060 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 27 Jul 2022 11:26:07 -0700 Subject: [PATCH] dependency: add refcount trace to dependency This works like the pkg tracing, but for dependencies --- libpkgconf/dependency.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpkgconf/dependency.c b/libpkgconf/dependency.c index 08dcbb2..d2d78ac 100644 --- a/libpkgconf/dependency.c +++ b/libpkgconf/dependency.c @@ -222,6 +222,7 @@ pkgconf_dependency_ref(pkgconf_client_t *client, pkgconf_dependency_t *dep) return NULL; dep->refcount++; + PKGCONF_TRACE(client, "%s: refcount@%p: %d", dep->package, dep, dep->refcount); return dep; } @@ -242,7 +243,9 @@ pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep) if (client != dep->owner) return; - if (--dep->refcount <= 0) + dep->refcount--; + PKGCONF_TRACE(client, "%s: refcount@%p: %d", dep->package, dep, dep->refcount); + if (dep->refcount <= 0) pkgconf_dependency_free_one(dep); }