X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.cpp;h=bbfb7d2437b1c3380d955e8ef3ce3301797a2882;hp=f01696b01c7be00399348b66fb7240f7f7e83c2d;hb=3d87310109576c77819c4c592d41bc1d9731978b;hpb=e6c1382ebf0994e55e9470724df985a1b7750709 diff --git a/pv/session.cpp b/pv/session.cpp index f01696b0..bbfb7d24 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -90,7 +90,6 @@ Session::Session(DeviceManager &device_manager) : capture_state_(Stopped), cur_samplerate_(0) { - set_default_device(); } Session::~Session() @@ -180,6 +179,11 @@ void Session::start_capture(function error_handler) } } + // Clear signal data + const set< shared_ptr > signal_data = get_data(); + for (const shared_ptr d : signal_data) + d->clear(); + // Begin the session sampling_thread_ = std::thread( &Session::sample_thread_proc, this, device_, @@ -234,9 +238,9 @@ bool Session::add_decoder(srd_decoder *const dec) // Make a list of all the channels std::vector all_channels; - for(const GSList *i = dec->channels; i; i = i->next) + for (const GSList *i = dec->channels; i; i = i->next) all_channels.push_back((const srd_channel*)i->data); - for(const GSList *i = dec->opt_channels; i; i = i->next) + for (const GSList *i = dec->opt_channels; i; i = i->next) all_channels.push_back((const srd_channel*)i->data); // Auto select the initial channels @@ -298,7 +302,7 @@ void Session::set_capture_state(capture_state state) lock_guard lock(sampling_mutex_); const bool changed = capture_state_ != state; capture_state_ = state; - if(changed) + if (changed) capture_state_changed(state); } @@ -412,10 +416,12 @@ void Session::sample_thread_proc(shared_ptr device, assert(device); assert(error_handler); + (void)device; + cur_samplerate_ = device_->read_config(ConfigKey::SAMPLERATE); try { - device_->session()->start(); + device_->start(); } catch(Error e) { error_handler(e.what()); return;