From 49682acd61d65c4986fc2b61c13d7d7a2d28127e Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 7 Jun 2017 18:12:03 -0400 Subject: [PATCH] Cancel the graph on destruction MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Consider the graph as canceled at the beginning of its destruction. This prohibits the use of some operations that are restricted to be used when the graph is active and running. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/graph/graph.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/graph/graph.c b/lib/graph/graph.c index 10dd1944..5b5acae7 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -80,6 +80,12 @@ void bt_graph_destroy(struct bt_object *obj) BT_LOGD("Destroying graph: addr=%p", graph); obj->ref_count.count++; + /* + * Cancel the graph to disallow some operations, like creating + * notification iterators and adding ports to components. + */ + (void) bt_graph_cancel(graph); + if (graph->connections) { BT_LOGD_STR("Destroying connections."); g_ptr_array_free(graph->connections, TRUE); -- 2.34.1