From 75c81842100f1f5c6ea739d1cde9d3b6525a4a2f Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Wed, 12 Aug 2026 18:05:05 +0800 Subject: [PATCH] hold the mutex for the whole step_callback function --- otherarch/sdcpp/sdtype_adapter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/otherarch/sdcpp/sdtype_adapter.cpp b/otherarch/sdcpp/sdtype_adapter.cpp index 8c66b49ea..6b7c4cca3 100644 --- a/otherarch/sdcpp/sdtype_adapter.cpp +++ b/otherarch/sdcpp/sdtype_adapter.cpp @@ -1771,11 +1771,11 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs) static void step_callback(int step, int frame_count, sd_image_t* image, bool is_noisy, void* data) { + std::lock_guard lock(geninfo.mux); double step_time = get_time_delta(geninfo.start_time); bool should_encode_preview = false; { - std::lock_guard lock(geninfo.mux); if (geninfo.gendata.status <= 1) { geninfo.gendata.status = 2; if (geninfo.preview_requested && !geninfo.preview_enabled) { @@ -1811,7 +1811,6 @@ static void step_callback(int step, int frame_count, sd_image_t* image, bool is_ } { - std::lock_guard lock(geninfo.mux); geninfo.gendata.step = step; geninfo.gendata.step_time = step_time; geninfo.gendata.preview = preview;