* ensures that this function is not called two times.
*/
BT_LOGD("Destroying graph: addr=%p", graph);
- obj->ref_count.count++;
+ obj->ref_count++;
/*
* Cancel the graph to disallow some operations, like creating
goto end;
}
- bt_object_init(graph, bt_graph_destroy);
-
- graph->connections = g_ptr_array_new_with_free_func(bt_object_release);
+ bt_object_init_shared(&graph->base, bt_graph_destroy);
+ graph->connections = g_ptr_array_new_with_free_func(
+ (GDestroyNotify) bt_object_try_spec_release);
if (!graph->connections) {
BT_LOGE_STR("Failed to allocate one GPtrArray.");
goto error;
}
- graph->components = g_ptr_array_new_with_free_func(bt_object_release);
+ graph->components = g_ptr_array_new_with_free_func(
+ (GDestroyNotify) bt_object_try_spec_release);
if (!graph->components) {
BT_LOGE_STR("Failed to allocate one GPtrArray.");
goto error;
BT_ASSERT(graph);
BT_ASSERT(component);
- BT_ASSERT(component->base.ref_count.count == 0);
+ BT_ASSERT(component->base.ref_count == 0);
BT_ASSERT(bt_component_borrow_graph(component) == graph);
init_can_consume = graph->can_consume;
}
/*
- * This calls bt_object_release() on the component, and since
- * its reference count is 0, its destructor is called. Its
+ * This calls bt_object_try_spec_release() on the component, and
+ * since its reference count is 0, its destructor is called. Its
* destructor calls the user's finalization method (if set).
*/
g_ptr_array_remove(graph->components, component);