From 3f7f0489fa3a2f46852511c5e1207b155d2cc12b Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 29 Apr 2021 18:38:29 -0700 Subject: multi_usrp_rfnoc: Fix get_device()->get_tree() Property tree access via the device tree was resulting in a segmentation fault because the device::_tree member was not properly initialized for the redirector_device class. The redirector_device also had a get_tree() method that was not actually called because the get_tree() method in the parent class was not declared virtual and all calls to get_tree() were done on the parent class (i.e. get_device()->get_tree(). - Added initializer for device::_tree member in redirector_device class constructor - Removed redirector_device::get_tree() method Signed-off-by: michael-west --- host/lib/usrp/multi_usrp_rfnoc.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index 6d0de68f9..f87e52190 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -74,7 +74,9 @@ constexpr char LOG_ID[] = "MULTI_USRP"; class redirector_device : public uhd::device { public: - redirector_device(multi_usrp* musrp_ptr) : _musrp(musrp_ptr) {} + redirector_device(multi_usrp* musrp_ptr) : _musrp(musrp_ptr) { + _tree = musrp_ptr->get_tree(); + } rx_streamer::sptr get_rx_stream(const stream_args_t& args) override { @@ -102,11 +104,6 @@ public: return false; } - uhd::property_tree::sptr get_tree(void) const - { - return _musrp->get_tree(); - } - device_filter_t get_device_type() const { return USRP; -- cgit v1.2.3