From dd816c5a0a032144dd11b99317713572598547bf Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 21 Nov 2020 22:55:54 -0500 Subject: [PATCH] Restore valid buffering. --- Outputs/ScanTargets/BufferingScanTarget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Outputs/ScanTargets/BufferingScanTarget.cpp b/Outputs/ScanTargets/BufferingScanTarget.cpp index 99333eca1..6c08a2d52 100644 --- a/Outputs/ScanTargets/BufferingScanTarget.cpp +++ b/Outputs/ScanTargets/BufferingScanTarget.cpp @@ -93,11 +93,12 @@ template void BufferingScanTarget::end_data(size_t actual_le // Acquire the producer lock. std::lock_guard lock_guard(producer_mutex_); - // Record that no further end_data calls are expected. + // Do nothing if no data write is actually ongoing. + if(!data_is_allocated_) return; data_is_allocated_ = false; - // Do nothing if no data write is actually ongoing. - if(allocation_has_failed_ || !data_is_allocated_) return; + // Check for other allocation failures. + if(allocation_has_failed_) return; // Bookend the start and end of the new data, to safeguard for precision errors in sampling. DataUnit *const sized_write_area = &reinterpret_cast(write_area_)[write_pointers_.write_area];