From 7f9f03da5f08770e40163a55ff12a23fbaebc828 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 3 Mar 2026 20:40:36 +0100 Subject: [PATCH] ImageBuffer: Fix counting idle slots --- common/ImageBuffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/ImageBuffer.cpp b/common/ImageBuffer.cpp index ce1ef37b..e3ced97f 100644 --- a/common/ImageBuffer.cpp +++ b/common/ImageBuffer.cpp @@ -109,12 +109,13 @@ ZeroCopyReturnValue *ImageBuffer::GetImageSlot() { auto i = free_slots.front(); free_slots.pop(); + if (v[i].status == ImageBufferEntryStatus::Idle) + --slots_idle; v[i].status = ImageBufferEntryStatus::InPreparation; v[i].image_number = INT64_MIN; v[i].image_size = 0; v[i].indexed = false; - --slots_idle; ++slots_preparation; // Wait for any preview thread currently reading this one