diff options
Diffstat (limited to 'host/lib/usrp/b200')
-rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 0b4eccd5e..78edec31c 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -33,6 +33,7 @@ #include <boost/lexical_cast.hpp> #include <boost/functional/hash.hpp> #include <boost/make_shared.hpp> +#include <boost/weak_ptr.hpp> #include <cstdio> #include <ctime> #include <cmath> @@ -730,9 +731,12 @@ b200_impl::~b200_impl(void) * setup radio control objects **********************************************************************/ -void lambda_set_bool_prop(property_tree::sptr tree, fs_path path, bool value, double) +void lambda_set_bool_prop(boost::weak_ptr<property_tree> tree_wptr, fs_path path, bool value, double) { - tree->access<bool>(path).set(value); + property_tree::sptr tree = tree_wptr.lock(); + if (tree) { + tree->access<bool>(path).set(value); + } } void b200_impl::setup_radio(const size_t dspno) @@ -796,7 +800,7 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create<bool>(rx_dsp_path / "rate" / "set").set(false); _tree->access<double>(rx_dsp_path / "rate" / "value") .set_coercer(boost::bind(&b200_impl::coerce_rx_samp_rate, this, perif.ddc, dspno, _1)) - .add_coerced_subscriber(boost::bind(&lambda_set_bool_prop, _tree, rx_dsp_path / "rate" / "set", true, _1)) + .add_coerced_subscriber(boost::bind(&lambda_set_bool_prop, boost::weak_ptr<property_tree>(_tree), rx_dsp_path / "rate" / "set", true, _1)) .add_coerced_subscriber(boost::bind(&b200_impl::update_rx_samp_rate, this, dspno, _1)) ; _tree->create<stream_cmd_t>(rx_dsp_path / "stream_cmd") @@ -812,7 +816,7 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create<bool>(tx_dsp_path / "rate" / "set").set(false); _tree->access<double>(tx_dsp_path / "rate" / "value") .set_coercer(boost::bind(&b200_impl::coerce_tx_samp_rate, this, perif.duc, dspno, _1)) - .add_coerced_subscriber(boost::bind(&lambda_set_bool_prop, _tree, tx_dsp_path / "rate" / "set", true, _1)) + .add_coerced_subscriber(boost::bind(&lambda_set_bool_prop, boost::weak_ptr<property_tree>(_tree), tx_dsp_path / "rate" / "set", true, _1)) .add_coerced_subscriber(boost::bind(&b200_impl::update_tx_samp_rate, this, dspno, _1)) ; |