From f743c922d6412c3e3362f289bd6196f3754c5616 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Nov 2016 19:18:54 -0600 Subject: Remove and recreate properties with member function callbacks in legacy_compat_impl dtor to prevent future sessions from calling into the destroyed bound functions --- host/lib/rfnoc/legacy_compat.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'host/lib/rfnoc') diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index e1eff757e..b660a21c7 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -103,6 +103,15 @@ uhd::meta_range_t lambda_const_meta_range(const double start, const double stop, { return uhd::meta_range_t(start, stop, step); } + +/*! Recreate passed property without bound subscribers. Maintains current property value. +*/ +template +static void recreate_property(const uhd::fs_path &path, uhd::property_tree::sptr &tree) { + T temp = tree->access(path).get(); + tree->remove(path); + tree->create(path).set(temp); +} /************************************************************************ * Class Definition ***********************************************************************/ @@ -169,6 +178,11 @@ public: } } + ~legacy_compat_impl() + { + remove_prop_subscribers(); + } + /************************************************************************ * API Calls ***********************************************************************/ @@ -590,6 +604,24 @@ private: // methods } } + + /*! Remove properties with bound functions in property tree and recreate + */ + void remove_prop_subscribers() + { + for (size_t mboard_idx = 0; mboard_idx < _num_mboards; mboard_idx++) { + uhd::fs_path root = mb_root(mboard_idx); + // Subdev specs + if (_tree->exists(root / "tx_subdev_spec")) { + recreate_property(root / "tx_subdev_spec", _tree); + } + + if (_tree->exists(root / "rx_subdev_spec")) { + recreate_property(root / "rx_subdev_spec", _tree); + } + } + } + /*! Default block connections. * * Tx connections: -- cgit v1.2.3 From f00463d2c39185d70eeef8772de74e3a68f26843 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 23 Nov 2016 09:37:03 -0800 Subject: rfnoc: Matched signatures for clear() --- host/include/uhd/rfnoc/block_ctrl_base.hpp | 2 +- host/lib/rfnoc/block_ctrl_base.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'host/lib/rfnoc') diff --git a/host/include/uhd/rfnoc/block_ctrl_base.hpp b/host/include/uhd/rfnoc/block_ctrl_base.hpp index 725f0d966..f770cf129 100644 --- a/host/include/uhd/rfnoc/block_ctrl_base.hpp +++ b/host/include/uhd/rfnoc/block_ctrl_base.hpp @@ -306,7 +306,7 @@ public: * * TODO: Find better name (it disconnects, clears FC...) */ - void clear(const size_t port = 0/* reserved, currently not used */); + void clear(); /*********************************************************************** * Argument handling diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp index c273fa76b..a4e7cb391 100644 --- a/host/lib/rfnoc/block_ctrl_base.cpp +++ b/host/lib/rfnoc/block_ctrl_base.cpp @@ -409,7 +409,7 @@ void block_ctrl_base::clear_command_time(const size_t port) iface_sptr->set_time(time_spec_t(0.0)); } -void block_ctrl_base::clear(const size_t /* port */) +void block_ctrl_base::clear() { UHD_RFNOC_BLOCK_TRACE() << "block_ctrl_base::clear() " << std::endl; // Call parent... -- cgit v1.2.3