aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/rfnoc_graph.cpp
diff options
context:
space:
mode:
authorSteven Koo <steven.koo@ni.com>2020-08-10 17:36:45 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-08-11 16:07:40 -0500
commitbe5bee81c4116388f6f3626b6ce1089845c4f792 (patch)
tree071d3a017575b2a43caf95515c74426305b54882 /host/lib/rfnoc/rfnoc_graph.cpp
parentfc3f91e0cfb77e295673ac04d310ded65863c119 (diff)
downloaduhd-be5bee81c4116388f6f3626b6ce1089845c4f792.tar.gz
uhd-be5bee81c4116388f6f3626b6ce1089845c4f792.tar.bz2
uhd-be5bee81c4116388f6f3626b6ce1089845c4f792.zip
rfnoc: Resolves streamer/link segfaults on python
This commit resolves a segfault that occurs during teardown. Since teardown isn't detereministic in python, there were cases where the graph would destruct before the streamers or links got chance to cleanup. This would result in a segfault. This change gives the lambda a shared pointer to the object the callback method is calling on, so that it won't destruct before being called.
Diffstat (limited to 'host/lib/rfnoc/rfnoc_graph.cpp')
-rw-r--r--host/lib/rfnoc/rfnoc_graph.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp
index 027d27f81..2e90fb48f 100644
--- a/host/lib/rfnoc/rfnoc_graph.cpp
+++ b/host/lib/rfnoc/rfnoc_graph.cpp
@@ -442,15 +442,17 @@ public:
uhd::rx_streamer::sptr create_rx_streamer(
const size_t num_ports, const uhd::stream_args_t& args)
{
+ auto this_graph = shared_from_this();
return std::make_shared<rfnoc_rx_streamer>(
- num_ports, args, [this](const std::string& id) { this->disconnect(id); });
+ num_ports, args, [this_graph](const std::string& id) { this_graph->disconnect(id); });
}
uhd::tx_streamer::sptr create_tx_streamer(
const size_t num_ports, const uhd::stream_args_t& args)
{
+ auto this_graph = shared_from_this();
return std::make_shared<rfnoc_tx_streamer>(
- num_ports, args, [this](const std::string& id) { this->disconnect(id); });
+ num_ports, args, [this_graph](const std::string& id) { this_graph->disconnect(id); });
}
size_t get_num_mboards() const