Skip to content

Commit

Permalink
Update final image size: do it only on darkroom leave
Browse files Browse the repository at this point in the history
That function only updates the final image size in metadata, for collection purposes. But it is called in many places, assumes we have a darkroom pipeline, and lock its mutex. This hypothesis is a bit wild and the mutex locking will create dead locks. All in all, we only need to update sizes once, when leaving darkroom. Or when we update an history (pasting/styles) in lighttable... but current design anyway works only with an active darkroom pipeline.

All in all, image dimensions metadata are rarely used, we don't really care about them, and anyway they are not important enough to disrupt the whole running sequence.

Another great piece of design from 2020…
  • Loading branch information
aurelienpierre committed Jan 17, 2025
1 parent 4be9cac commit f5ca43a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 17 deletions.
2 changes: 0 additions & 2 deletions src/common/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,6 @@ void dt_image_set_flip(const int32_t imgid, const dt_image_orientation_t orienta
dt_history_hash_write_from_history(imgid, DT_HISTORY_HASH_CURRENT);

dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);
dt_image_update_final_size(imgid);
// write that through to xmp:
dt_image_write_sidecar_file(imgid);
}

Expand Down
3 changes: 0 additions & 3 deletions src/develop/imageop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1869,9 +1869,6 @@ void dt_iop_request_focus(dt_iop_module_t *module)
// we also remove the focus css class
GtkWidget *iop_w = gtk_widget_get_parent(dt_iop_gui_get_pluginui(out_focus_module));
dt_gui_remove_class(iop_w, "dt_module_focus");

// if the module change the image size, we update the final sizes
if(out_focus_module->modify_roi_out) dt_image_update_final_size(darktable.develop->preview_pipe->output_imgid);
}

/* set the focus on module */
Expand Down
6 changes: 1 addition & 5 deletions src/iop/ashift.c
Original file line number Diff line number Diff line change
Expand Up @@ -5161,9 +5161,7 @@ static void _enter_edit_mode(GtkToggleButton* button, struct dt_iop_module_t *se
gtk_widget_set_sensitive(g->commit_button, FALSE);
}

// It sucks that we need to invalidate the preview too but we need its final dimension.
dt_image_update_final_size(self->dev->preview_pipe->output_imgid);
dt_dev_invalidate_all(self->dev);
dt_dev_invalidate_zoom(self->dev);
dt_dev_refresh_ui_images(self->dev);
}

Expand All @@ -5181,8 +5179,6 @@ static void _event_commit_clicked(GtkButton *button, dt_iop_module_t *self)

memcpy(p, &g->new_params, sizeof(dt_iop_ashift_params_t));

dt_image_update_final_size(self->dev->preview_pipe->output_imgid);

// Commit history and refresh view
dt_dev_add_history_item(darktable.develop, self, TRUE);

Expand Down
5 changes: 0 additions & 5 deletions src/iop/clipping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,11 +1336,6 @@ static void _event_preview_updated_callback(gpointer instance, dt_iop_module_t *
{
dt_iop_clipping_gui_data_t *g = (dt_iop_clipping_gui_data_t *)self->gui_data;
g->preview_ready = TRUE;
if(self->dev->gui_module != self)
{
dt_image_update_final_size(self->dev->preview_pipe->output_imgid);
}

DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(darktable.signals, G_CALLBACK(_event_preview_updated_callback), self);
// force max size to be recomputed
g->clip_max_pipe_hash = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/iop/crop.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,6 @@ static void _event_commit_clicked(GtkButton *button, dt_iop_module_t *self)
g->editing = FALSE;
gtk_widget_set_sensitive(g->commit_button, FALSE);

dt_image_update_final_size(self->dev->preview_pipe->output_imgid);

// Commit history and refresh view
dt_dev_add_history_item(darktable.develop, self, TRUE);

Expand Down

0 comments on commit f5ca43a

Please sign in to comment.