]> sigrok.org Git - libsigrok.git/commitdiff
C++: Don't clear Session::_owned_devices() in Session::remove_devices().
authorMartin Ling <redacted>
Sun, 12 Oct 2014 15:18:30 +0000 (16:18 +0100)
committerBert Vermeulen <redacted>
Wed, 15 Oct 2014 11:44:25 +0000 (13:44 +0200)
Owned devices are freed only when the session is destroyed.

bindings/cxx/classes.cpp

index 9013e41ae9d44ad004cfe2a9b218e742a719432e..9bce464c9de979099c6b1faf2a0ab72baba70dcd 100644 (file)
@@ -871,16 +871,6 @@ vector<shared_ptr<Device>> 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));
 }