]> sigrok.org Git - pulseview.git/commitdiff
Session: Improve signal handling during device selection
authorSoeren Apel <redacted>
Sun, 3 Apr 2016 18:33:19 +0000 (20:33 +0200)
committerSoeren Apel <redacted>
Sun, 3 Apr 2016 18:33:19 +0000 (20:33 +0200)
Changing devices now forces an update of the view's signal handling.
This will allow clearing the view properly in-between devices.

pv/session.cpp

index 9fd8fb3eb9b5bdf6a1c03cf5f457e9b5113de493..e2b6dd7174a0bcdfcadef6ab0041454ab4a2a8c0 100644 (file)
@@ -138,6 +138,13 @@ void Session::set_device(shared_ptr<devices::Device> device)
        if (device_)
                device_->close();
 
+       device_.reset();
+
+       // Remove all traces
+       signals_.clear();
+       decode_traces_.clear();
+       signals_changed();
+
        device_ = std::move(device);
        device_->open();
        device_->session()->add_datafeed_callback([=]
@@ -145,8 +152,6 @@ void Session::set_device(shared_ptr<devices::Device> device)
                        data_feed_in(device, packet);
                });
 
-       decode_traces_.clear();
-
        update_signals();
        device_selected();
 }