From: Soeren Apel Date: Fri, 20 Dec 2019 18:21:22 +0000 (+0100) Subject: Fix #1446 by starting the decode only for the last PD in the stack X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ed75426f60765fe965d8bfdd21eb904cccc92804;p=pulseview.git Fix #1446 by starting the decode only for the last PD in the stack --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 12379518..a6d4a9d6 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -76,7 +76,7 @@ const vector< shared_ptr >& DecodeSignal::decoder_stack() const return stack_; } -void DecodeSignal::stack_decoder(const srd_decoder *decoder) +void DecodeSignal::stack_decoder(const srd_decoder *decoder, bool restart_decode) { assert(decoder); @@ -101,7 +101,8 @@ void DecodeSignal::stack_decoder(const srd_decoder *decoder) decoder_stacked((void*)dec.get()); - begin_decode(); + if (restart_decode) + begin_decode(); } void DecodeSignal::remove_decoder(int index) diff --git a/pv/data/decodesignal.hpp b/pv/data/decodesignal.hpp index 8bcc5620..74ffbd1f 100644 --- a/pv/data/decodesignal.hpp +++ b/pv/data/decodesignal.hpp @@ -100,7 +100,7 @@ public: bool is_decode_signal() const; const vector< shared_ptr >& decoder_stack() const; - void stack_decoder(const srd_decoder *decoder); + void stack_decoder(const srd_decoder *decoder, bool restart_decode=true); void remove_decoder(int index); bool toggle_decoder_visibility(int index); diff --git a/pv/session.cpp b/pv/session.cpp index dc16dd97..0e071fbc 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -1472,8 +1472,10 @@ void Session::on_new_decoders_selected(vector decoders) shared_ptr signal = add_decode_signal(); if (signal) - for (const srd_decoder* d : decoders) - signal->stack_decoder(d); + for (unsigned int i = 0; i < decoders.size(); i++) { + const srd_decoder* d = decoders[i]; + signal->stack_decoder(d, !(i < decoders.size() - 1)); + } } #endif