X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Ffilter.c;h=6cae9b3b76da2e163f94bd1ccc49fbe44e91fe51;hb=bd7cc15bddddb727ea02fb44bde2d9f15cd82847;hp=4e6db19fd5d59508f9182443a10b7cfe01b2affe;hpb=851b70bd612310f258e8b03562e1833700f8832b;p=babeltrace.git diff --git a/lib/graph/filter.c b/lib/graph/filter.c index 4e6db19f..6cae9b3b 100644 --- a/lib/graph/filter.c +++ b/lib/graph/filter.c @@ -36,6 +36,7 @@ #include #include #include +#include BT_HIDDEN void bt_component_filter_destroy(struct bt_component *component) @@ -251,6 +252,7 @@ enum bt_component_status bt_private_component_filter_add_input_private_port( struct bt_port *port = NULL; struct bt_component *component = bt_component_from_private(private_component); + struct bt_graph *graph; if (!component) { BT_LOGW_STR("Invalid parameter: component is NULL."); @@ -267,6 +269,17 @@ enum bt_component_status bt_private_component_filter_add_input_private_port( goto end; } + graph = bt_component_borrow_graph(component); + + if (graph && bt_graph_is_canceled(graph)) { + BT_LOGW("Cannot add output port to filter component: graph is canceled: " + "comp-addr=%p, comp-name=\"%s\", graph-addr=%p", + component, bt_component_get_name(component), + bt_component_borrow_graph(component)); + status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED; + goto end; + } + /* bt_component_add_input_port() logs details/errors */ port = bt_component_add_input_port(component, name, user_data); if (!port) { @@ -315,6 +328,7 @@ enum bt_component_status bt_private_component_filter_add_output_private_port( struct bt_port *port = NULL; struct bt_component *component = bt_component_from_private(private_component); + struct bt_graph *graph; if (!component) { BT_LOGW_STR("Invalid parameter: component is NULL."); @@ -331,6 +345,17 @@ enum bt_component_status bt_private_component_filter_add_output_private_port( goto end; } + graph = bt_component_borrow_graph(component); + + if (graph && bt_graph_is_canceled(graph)) { + BT_LOGW("Cannot add output port to filter component: graph is canceled: " + "comp-addr=%p, comp-name=\"%s\", graph-addr=%p", + component, bt_component_get_name(component), + bt_component_borrow_graph(component)); + status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED; + goto end; + } + /* bt_component_add_output_port() logs details/errors */ port = bt_component_add_output_port(component, name, user_data); if (!port) {