]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decoderstack.cpp
Check required probes before starting the decode thread
[pulseview.git] / pv / data / decoderstack.cpp
index 87ac32613f954e8fdbaa4333513e4b3211266dbd..c197e019fd16c6b1e1d5d35ff2aa02d62b9e2bfa 100644 (file)
@@ -193,6 +193,14 @@ void DecoderStack::begin_decode()
 
        clear();
 
+       // Check that all decoders have the required probes
+       BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
+               if (!dec->have_required_probes()) {
+                       _error_message = tr("One or more required probes "
+                               "have not been specified");
+                       return;
+               }
+
        // Add classes
        BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec, _stack)
        {
@@ -249,8 +257,7 @@ void DecoderStack::begin_decode()
        if (_samplerate == 0.0)
                _samplerate = 1.0;
 
-       _decode_thread = boost::thread(&DecoderStack::decode_proc, this,
-               data);
+       _decode_thread = boost::thread(&DecoderStack::decode_proc, this);
 }
 
 uint64_t DecoderStack::get_max_sample_count() const
@@ -309,9 +316,10 @@ void DecoderStack::decode_data(
                }
        }
 
+       new_decode_data();
 }
 
-void DecoderStack::decode_proc(shared_ptr<data::Logic> data)
+void DecoderStack::decode_proc()
 {
        optional<int64_t> sample_count;
        srd_session *session;
@@ -320,11 +328,6 @@ void DecoderStack::decode_proc(shared_ptr<data::Logic> data)
        assert(data);
        assert(_snapshot);
 
-       // Check that all decoders have the required probes
-       BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
-               if (!dec->have_required_probes())
-                       return;
-
        // Create the session
        srd_session_new(&session);
        assert(session);
@@ -413,8 +416,6 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
 
        // Add the annotation
        (*row_iter).second.push_annotation(a);
-
-       d->new_decode_data();
 }
 
 void DecoderStack::on_new_frame()