Skip to content

Commit abbd97c

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Two dt_dev_process_image_job() timing issues
1. While running dt_dev_process_image_job() it's dt_dev_pixelpipe_process() could return with an error flag due to a pipe->shutdown. If so, the shutdown flag must be cleared before restarting to safely avoid an endless loop. 2. The preview pipe should raise the signal after updating the final size if that was requested by history_postpone_invalidate
1 parent 933adec commit abbd97c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/develop/develop.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,11 @@ void dt_dev_process_image_job(dt_develop_t *dev,
444444
dt_pthread_mutex_unlock(&pipe->mutex);
445445
return;
446446
}
447-
// or because the pipeline changed?
447+
// or because the pipeline changed or shutdown?
448448
else
449449
{
450+
if(dt_atomic_exch_int(&pipe->shutdown, FALSE))
451+
dt_print_pipe(DT_DEBUG_PIPE, "spurious shutdown", pipe, NULL, pipe->devid, NULL, NULL);
450452
if(port && port->widget) dt_control_queue_redraw_widget(port->widget);
451453
goto restart;
452454
}
@@ -467,16 +469,23 @@ void dt_dev_process_image_job(dt_develop_t *dev,
467469
dt_control_busy_leave();
468470
dt_pthread_mutex_unlock(&pipe->mutex);
469471

470-
if(dev->gui_attached && !dev->gui_leaving && signal != -1)
471-
DT_CONTROL_SIGNAL_RAISE(signal);
472+
const gboolean signalling = dev->gui_attached && !dev->gui_leaving && signal != -1;
472473

473-
if(port) return;
474+
if(port) // reminder: only the preview pipe is called without a port
475+
{
476+
if(signalling && signal != DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED)
477+
DT_CONTROL_SIGNAL_RAISE(signal);
478+
return;
479+
}
474480

475-
// preview pipe only
481+
// rest is for preview pipe only
476482

477483
if(!dev->history_postpone_invalidate)
478484
dt_image_update_final_size(dev->preview_pipe->output_imgid);
479485

486+
if(signalling) // raise this after possibly updating the final size
487+
DT_CONTROL_SIGNAL_RAISE(signal);
488+
480489
dev->gui_previous_pipe_time = dt_get_wtime();
481490

482491
#ifdef USE_LUA

0 commit comments

Comments
 (0)