dependency: add debug information for dependency refcounting

pull/239/head
Dylan Baker 2022-08-04 11:52:26 -07:00
parent 4934205737
commit e71a5a3370
1 changed files with 5 additions and 1 deletions

View File

@ -229,6 +229,7 @@ pkgconf_dependency_ref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
return NULL; return NULL;
dep->refcount++; dep->refcount++;
PKGCONF_TRACE(client, "%s refcount@%p: %d", dep->package, dep, dep->refcount);
return dep; return dep;
} }
@ -249,7 +250,10 @@ pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
if (client != dep->owner) if (client != dep->owner)
return; 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); pkgconf_dependency_free_one(dep);
} }