diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-10-16 09:19:26 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-10-22 15:01:15 -0500 |
commit | 5ea43897419aac8db824944abc764868232b45af (patch) | |
tree | 460138969706163bcef667c300451db636923d41 /host/lib/rfnoc | |
parent | a51ccbba88d6a3f3012b84a1eed55725d41c7fd7 (diff) | |
download | uhd-5ea43897419aac8db824944abc764868232b45af.tar.gz uhd-5ea43897419aac8db824944abc764868232b45af.tar.bz2 uhd-5ea43897419aac8db824944abc764868232b45af.zip |
graph: Re-fetch dst_node descriptor after src_node potential removal
The graph_t::disconnect(src_node, dst_node) function removes connections
(edges) from src_node to dst_node in the graph, and then removes the
nodes (vertices) if their degree is zero after removing the connections.
Because removing a vertex from the graph invalidates vertex descriptors,
the graph_t::_remove_node() function resynchronizes the node-to-vertex
descriptor map after removing the vertex.
However, in graph_t::disconnect(), the vertex descriptor corresponding
to dst_node was not being refetched after the potential removal of
src_node, which results in the incorrect removal of innocent nodes under
certain circumstances. This commit ensures that the node-to-vertex
descriptor is reconsulted for the vertex descriptor corresponding to
dst_node before removing it from the tree.
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r-- | host/lib/rfnoc/graph.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/host/lib/rfnoc/graph.cpp b/host/lib/rfnoc/graph.cpp index d4f2d37e7..2edf591b3 100644 --- a/host/lib/rfnoc/graph.cpp +++ b/host/lib/rfnoc/graph.cpp @@ -200,6 +200,9 @@ void graph_t::disconnect(node_ref_t src_node, node_ref_t dst_node, graph_edge_t _remove_node(src_node); } + // Re-look up the vertex descriptor for dst_node, as the act of removing + // src_node may have modified it + dst_vertex_desc = _node_map.at(dst_node); if (boost::degree(dst_vertex_desc, _graph) == 0) { _remove_node(dst_node); } |