C++: Don't clear Session::_owned_devices() in Session::remove_devices().
Owned devices are freed only when the session is destroyed.
This commit is contained in:
parent
1de3ccede9
commit
f36f7d0282
|
@ -871,16 +871,6 @@ vector<shared_ptr<Device>> Session::devices()
|
||||||
|
|
||||||
void Session::remove_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();
|
_other_devices.clear();
|
||||||
check(sr_session_dev_remove_all(_structure));
|
check(sr_session_dev_remove_all(_structure));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue