From: Joel Holdsworth Date: Sat, 18 Jan 2014 16:04:07 +0000 (+0000) Subject: SigSession: Tidied update_signals X-Git-Tag: pulseview-0.2.0~136 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=39e680c230c4f26f25d2688028964732647b957f;p=pulseview.git SigSession: Tidied update_signals --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 82fa8770..ecc12503 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -384,7 +384,6 @@ void SigSession::update_signals(const sr_dev_inst *const sdi) { assert(_capture_state == Stopped); - shared_ptr signal; unsigned int logic_probe_count = 0; unsigned int analog_probe_count = 0; @@ -429,34 +428,42 @@ void SigSession::update_signals(const sr_dev_inst *const sdi) } // Make the Signals list - { + do { lock_guard lock(_signals_mutex); _signals.clear(); - if(sdi) { - for (const GSList *l = sdi->probes; l; l = l->next) { - sr_probe *const probe = (sr_probe *)l->data; - assert(probe); - - switch(probe->type) { - case SR_PROBE_LOGIC: - signal = shared_ptr( - new view::LogicSignal(*this, probe, - _logic_data)); - break; - - case SR_PROBE_ANALOG: - signal = shared_ptr( - new view::AnalogSignal(*this, probe, - _analog_data)); - break; - } - - _signals.push_back(signal); + if(!sdi) + break; + + for (const GSList *l = sdi->probes; l; l = l->next) { + shared_ptr signal; + sr_probe *const probe = (sr_probe *)l->data; + assert(probe); + + switch(probe->type) { + case SR_PROBE_LOGIC: + signal = shared_ptr( + new view::LogicSignal(*this, probe, + _logic_data)); + break; + + case SR_PROBE_ANALOG: + signal = shared_ptr( + new view::AnalogSignal(*this, probe, + _analog_data)); + break; + + default: + assert(0); + break; } + + assert(signal); + _signals.push_back(signal); } - } + + } while(0); signals_changed(); }