From 3358e899486405f0cb368fdf01ca94c57e761498 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Fri, 17 May 2024 15:38:57 +0800 Subject: [PATCH] Do not add decode task when the collect task is not end --- DSView/pv/data/decoderstack.cpp | 5 +++++ DSView/pv/sigsession.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index a2bf1658..1311363b 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -560,6 +560,11 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod uint64_t align_sample_count = _snapshot->get_ring_sample_count(); + if (align_sample_count == 0){ + dsv_info("Have no data to decode."); + return; + } + if (end_index >= align_sample_count){ end_index = align_sample_count - 1; dsv_info("Reset the decode end sample, new:%llu, old:%llu", diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index eb654c1a..02ef29af 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -1688,7 +1688,15 @@ namespace pv { auto trace = get_decoder_trace(index); - if (trace && trace->create_popup(false)) + if (trace == NULL){ + return; + } + + if (!trace->create_popup(false)){ + return; + } + + if (have_view_data() && !is_working()) { remove_decode_task(trace); // remove old task trace->decoder()->clear(); @@ -1868,8 +1876,7 @@ namespace pv std::lock_guard lock(_decode_task_mutex); _decode_tasks.push_back(trace); - if (!_is_decoding) - { + if (!_is_decoding){ if (_decode_thread.joinable()) _decode_thread.join();