Add bt_graph_add_component(), make bt_component_create() internal
[babeltrace.git] / include / babeltrace / object-internal.h
index 545a20aadd21a7f9f9bd3b78971f9e64b0c5182b..9859e329d36a34565bb86daedb75762387d8cacb 100644 (file)
@@ -59,7 +59,12 @@ void bt_object_release(void *ptr)
 {
        struct bt_object *obj = ptr;
 
-       if (obj && obj->release && !bt_object_get_ref_count(obj)) {
+#ifdef BT_LOGV
+       BT_LOGV("Releasing object: addr=%p, ref-count=%lu", ptr,
+               obj->ref_count.count);
+#endif
+
+       if (obj && obj->release && bt_object_get_ref_count(obj) == 0) {
                obj->release(obj);
        }
 }
@@ -68,7 +73,14 @@ static inline
 void generic_release(struct bt_object *obj)
 {
        if (obj->parent) {
-               void *parent = obj->parent;
+               struct bt_object *parent = obj->parent;
+
+#ifdef BT_LOGV
+               BT_LOGV("Releasing parented object: addr=%p, ref-count=%lu, "
+                       "parent-addr=%p, parent-ref-count=%lu",
+                       obj, obj->ref_count.count,
+                       parent, parent->ref_count.count);
+#endif
 
                if (obj->parent_is_owner_listener) {
                        /*
@@ -110,6 +122,11 @@ void bt_object_set_parent(void *child_ptr, void *parent)
                return;
        }
 
+#ifdef BT_LOGV
+       BT_LOGV("Setting object's parent: addr=%p, parent-addr=%p",
+               child_ptr, parent);
+#endif
+
        /*
         * It is assumed that a "child" being "parented" is publicly reachable.
         * Therefore, a reference to its parent must be taken. The reference
This page took 0.029538 seconds and 4 git commands to generate.