From ff3179fef651ec3ef6ff4b6d693a00de4a240104 Mon Sep 17 00:00:00 2001 From: Mark Meserve Date: Tue, 10 Apr 2018 13:35:19 -0500 Subject: x300: handle bad weak_ptr during pcie discovery --- host/lib/usrp/x300/x300_impl.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 97551e07a..d74aad806 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -213,7 +213,15 @@ static device_addrs_t x300_find_pcie(const device_addr_t &hint, bool explicit_qu if (get_pcie_zpu_iface_registry().has_key(resource_d)) { zpu_ctrl = get_pcie_zpu_iface_registry()[resource_d].lock(); - } else { + if (!zpu_ctrl) + { + get_pcie_zpu_iface_registry().pop(resource_d); + } + } + + // if the registry didn't have a key OR that key was an orphaned weak_ptr + if (!zpu_ctrl) + { zpu_ctrl = x300_make_ctrl_iface_pcie(kernel_proxy, false /* suppress timeout errors */); //We don't put this zpu_ctrl in the registry because we need //a persistent niriok_proxy associated with the object -- cgit v1.2.3