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