]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decodesignal.cpp
Fix bar displaying undecoded area
[pulseview.git] / pv / data / decodesignal.cpp
index 8483d91d0ce4a2b41de67a07605d2a757d761137..4739b60675ab3e97ee9496ebc1a1d642ccf12bca 100644 (file)
@@ -902,6 +902,13 @@ void DecodeSignal::decode_data(
                const int64_t chunk_end = min(i + chunk_sample_count,
                        abs_start_samplenum + sample_count);
 
                const int64_t chunk_end = min(i + chunk_sample_count,
                        abs_start_samplenum + sample_count);
 
+               // Report this chunk as already decoded so that annotations don't
+               // appear in an area that we claim to not having been been decoded yet
+               {
+                       lock_guard<mutex> lock(output_mutex_);
+                       segments_.at(current_segment_id_).samples_decoded = chunk_end;
+               }
+
                int64_t data_size = (chunk_end - i) * unit_size;
                uint8_t* chunk = new uint8_t[data_size];
                input_segment->get_samples(i, chunk_end, chunk);
                int64_t data_size = (chunk_end - i) * unit_size;
                uint8_t* chunk = new uint8_t[data_size];
                input_segment->get_samples(i, chunk_end, chunk);
@@ -915,11 +922,6 @@ void DecodeSignal::decode_data(
 
                delete[] chunk;
 
 
                delete[] chunk;
 
-               {
-                       lock_guard<mutex> lock(output_mutex_);
-                       segments_.at(current_segment_id_).samples_decoded = chunk_end;
-               }
-
                // Notify the frontend that we processed some data and
                // possibly have new annotations as well
                new_annotations();
                // Notify the frontend that we processed some data and
                // possibly have new annotations as well
                new_annotations();