From 4cc0df94c1027add1e62dfdf81e48eda959783c9 Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Wed, 3 Jan 2018 17:14:51 +0100 Subject: [PATCH] LogicSegment: Limit end in get_subsampled_edges() if needed This is necessary because there is a race condition between adding samples and trace repainting. --- pv/data/logicsegment.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pv/data/logicsegment.cpp b/pv/data/logicsegment.cpp index dff99c01..62f188e3 100644 --- a/pv/data/logicsegment.cpp +++ b/pv/data/logicsegment.cpp @@ -314,7 +314,6 @@ void LogicSegment::get_subsampled_edges( bool last_sample; bool fast_forward; - assert(end <= get_sample_count()); assert(start <= end); assert(min_length > 0); assert(sig_index >= 0); @@ -322,6 +321,10 @@ void LogicSegment::get_subsampled_edges( lock_guard lock(mutex_); + // Make sure we only process as many samples as we have + if (end > get_sample_count()) + end = get_sample_count(); + const uint64_t block_length = (uint64_t)max(min_length, 1.0f); const unsigned int min_level = max((int)floorf(logf(min_length) / LogMipMapScaleFactor) - 1, 0); -- 2.30.2