Skip to content

Commit

Permalink
Protect against reentrant dt_styles_apply_to_dev()
Browse files Browse the repository at this point in the history
We must not apply all the requested history changes until the last request to do so
has finalized.
This can happen as reported in darktable-org#18311 (and elsewhere by lua calls to this function).
  • Loading branch information
jenshannoschwalm committed Feb 2, 2025
1 parent 61b0bd1 commit ae91825
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common/styles.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,8 @@ void dt_styles_apply_to_dev(const char *name, const dt_imgid_t imgid)
return;
}

dt_pthread_mutex_lock(&darktable.dev_threadsafe);

dt_print(DT_DEBUG_DEV | DT_DEBUG_PIPE,
"[dt_styles_apply_to_dev] apply '%s' to darkroom ID=%d", name, imgid);

Expand All @@ -1044,6 +1046,7 @@ void dt_styles_apply_to_dev(const char *name, const dt_imgid_t imgid)
dt_iop_connect_accels_all();

dt_control_log(_("applied style `%s' on current image"), name);
dt_pthread_mutex_unlock(&darktable.dev_threadsafe);
}

void dt_styles_delete_by_name_adv(const char *name, const gboolean raise, const gboolean shortcut)
Expand Down

0 comments on commit ae91825

Please sign in to comment.