From: Philippe Proulx Date: Wed, 7 Jun 2017 22:12:03 +0000 (-0400) Subject: Cancel the graph on destruction X-Git-Tag: v2.0.0-pre1~36 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=49682acd61d65c4986fc2b61c13d7d7a2d28127e;p=babeltrace.git Cancel the graph on destruction 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 --- 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);