From: Martin Ling Date: Sun, 12 Oct 2014 15:18:30 +0000 (+0100) Subject: C++: Don't clear Session::_owned_devices() in Session::remove_devices(). X-Git-Tag: libsigrok-0.4.0~860 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f36f7d02826a4240c5bb56ccc0dfd7d689093765;p=libsigrok.git C++: Don't clear Session::_owned_devices() in Session::remove_devices(). Owned devices are freed only when the session is destroyed. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 9013e41a..9bce464c 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -871,16 +871,6 @@ vector> Session::devices() void Session::remove_devices() { - for (auto entry : _owned_devices) - { - // We own this device. Make sure it's not referenced. - auto device = entry.second; - auto ptr = device->get_shared_pointer(this); - if (ptr.use_count() > 1) - throw Error(SR_ERR_BUG); - delete device; - } - _owned_devices.clear(); _other_devices.clear(); check(sr_session_dev_remove_all(_structure)); }