Fix #1446 by starting the decode only for the last PD in the stack
authorSoeren Apel <soeren@apelpie.net>
Fri, 20 Dec 2019 18:21:22 +0000 (19:21 +0100)
committerSoeren Apel <soeren@apelpie.net>
Fri, 20 Dec 2019 22:52:01 +0000 (23:52 +0100)
pv/data/decodesignal.cpp
pv/data/decodesignal.hpp
pv/session.cpp

index 12379518acf9bb90dda59e376ee9b0145d5b7b69..a6d4a9d603b23e0820a9a6a869658020e7787079 100644 (file)
@@ -76,7 +76,7 @@ const vector< shared_ptr<Decoder> >& 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)
index 8bcc562068a13d6655425b834566968bb51420cc..74ffbd1ff470c64cd88678ef429ccfc739997883 100644 (file)
@@ -100,7 +100,7 @@ public:
        bool is_decode_signal() const;
        const vector< shared_ptr<data::decode::Decoder> >& 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);
 
index dc16dd97f9b616e4d7f6911e665ddf248a20815d..0e071fbcdd9882d96ac7c4714ed3e969cf6e24b6 100644 (file)
@@ -1472,8 +1472,10 @@ void Session::on_new_decoders_selected(vector<const srd_decoder*> decoders)
        shared_ptr<data::DecodeSignal> 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