X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fdecodesignal.cpp;h=a57a9a1a9624556d5658dc3d6d3877f160194095;hp=5acf9eec634380533a2cb1c0bfeceb767cec6f7b;hb=762ab7a4b20928a784b2b3400ce748d901e32d2d;hpb=5e95d3d980490ce37d3ae404998b8c89089391e3 diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 5acf9eec..a57a9a1a 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -79,7 +79,9 @@ const vector< shared_ptr >& DecodeSignal::decoder_stack() const void DecodeSignal::stack_decoder(const srd_decoder *decoder) { assert(decoder); - stack_.push_back(make_shared(decoder)); + const shared_ptr dec = make_shared(decoder); + + stack_.push_back(dec); // Set name if this decoder is the first in the list if (stack_.size() == 1) @@ -88,7 +90,7 @@ void DecodeSignal::stack_decoder(const srd_decoder *decoder) // Include the newly created decode channels in the channel lists update_channel_list(); - auto_assign_signals(); + auto_assign_signals(dec); commit_decoder_channels(); begin_decode(); } @@ -263,12 +265,16 @@ const vector DecodeSignal::get_channels() const return channels_; } -void DecodeSignal::auto_assign_signals() +void DecodeSignal::auto_assign_signals(const shared_ptr dec) { bool new_assignment = false; // Try to auto-select channels that don't have signals assigned yet for (data::DecodeChannel &ch : channels_) { + // If a decoder is given, auto-assign only its channels + if (dec && (ch.decoder_ != dec)) + continue; + if (ch.assigned_signal) continue;