hold the mutex for the whole step_callback function

This commit is contained in:
Concedo
2026-08-12 18:05:05 +08:00
parent 533aa18897
commit 75c8184210
+1 -2
View File
@@ -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<std::mutex> lock(geninfo.mux);
double step_time = get_time_delta(geninfo.start_time);
bool should_encode_preview = false;
{
std::lock_guard<std::mutex> 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<std::mutex> lock(geninfo.mux);
geninfo.gendata.step = step;
geninfo.gendata.step_time = step_time;
geninfo.gendata.preview = preview;