X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Fcomponent.c;h=8ffab8e0b20fe5d8fa7544f0c5ca4bfeb8c7b901;hb=3fea54f69edd1780566230255da196cb6e82df62;hp=185b8d10843e4f0d9aad45792ce2c9fb81d7b3b2;hpb=5c5632787fc9cafa602c89a28966bcfd01ec0204;p=babeltrace.git diff --git a/lib/graph/component.c b/lib/graph/component.c index 185b8d10..8ffab8e0 100644 --- a/lib/graph/component.c +++ b/lib/graph/component.c @@ -86,7 +86,7 @@ void bt_component_destroy(struct bt_object *obj) * bt_put(): the reference count would go from 1 to 0 again and * this function would be called again. */ - obj->ref_count.count++; + obj->ref_count++; component = container_of(obj, struct bt_component, base); BT_LOGD("Destroying component: addr=%p, name=\"%s\", graph-addr=%p", component, bt_component_get_name(component), @@ -266,7 +266,8 @@ enum bt_component_status bt_component_create( goto end; } - bt_object_init(component, bt_component_destroy); + bt_object_init_shared_with_parent(&component->base, + bt_component_destroy); component->class = bt_get(component_class); component->destroy = component_destroy_funcs[type]; component->name = g_string_new(name); @@ -277,7 +278,7 @@ enum bt_component_status bt_component_create( } component->input_ports = g_ptr_array_new_with_free_func( - bt_object_release); + (GDestroyNotify) bt_object_try_spec_release); if (!component->input_ports) { BT_LOGE_STR("Failed to allocate one GPtrArray."); status = BT_COMPONENT_STATUS_NOMEM; @@ -285,7 +286,7 @@ enum bt_component_status bt_component_create( } component->output_ports = g_ptr_array_new_with_free_func( - bt_object_release); + (GDestroyNotify) bt_object_try_spec_release); if (!component->output_ports) { BT_LOGE_STR("Failed to allocate one GPtrArray."); status = BT_COMPONENT_STATUS_NOMEM; @@ -368,7 +369,8 @@ BT_HIDDEN void bt_component_set_graph(struct bt_component *component, struct bt_graph *graph) { - bt_object_set_parent(component, graph ? &graph->base : NULL); + bt_object_set_parent(&component->base, + graph ? &graph->base : NULL); } struct bt_graph *bt_component_borrow_graph(struct bt_component *component)