Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/develop/blend.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ static void _refine_with_detail_mask(dt_iop_module_t *self,
float *lum = dt_masks_calc_detail_mask(piece, threshold, detail);
if(lum == NULL) goto error;

// src_hash encodes what the thresholded mask depends on (scharr data + slider value),
// so the distortion cache is invalidated when the details slider changes.
const dt_hash_t src_hash = dt_hash(p->scharr.hash, &level, sizeof(level));

// here we have the slightly blurred full detail mask available
float *warp_mask = dt_dev_distort_detail_mask(piece, lum, self);
float *warp_mask = dt_dev_distort_detail_mask(piece, lum, self, src_hash);
dt_free_align(lum);

if(warp_mask == NULL) goto error;
Expand Down Expand Up @@ -815,8 +819,12 @@ static void _refine_with_detail_mask_cl(dt_iop_module_t *self,
out = NULL;
blur = NULL;

// src_hash encodes what the thresholded mask depends on (scharr data + slider value),
// so the distortion cache is invalidated when the details slider changes.
const dt_hash_t src_hash = dt_hash(p->scharr.hash, &level, sizeof(level));

// here we have the slightly blurred full detail mask available
float *warp_mask = dt_dev_distort_detail_mask(piece, lum, self);
float *warp_mask = dt_dev_distort_detail_mask(piece, lum, self, src_hash);
dt_free_align(lum);
if(warp_mask == NULL)
{
Expand Down
9 changes: 7 additions & 2 deletions src/develop/develop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,11 +1373,16 @@ static void _dev_add_history_item(dt_develop_t *dev,
|| module != dev->gui_module)
dt_dev_invalidate_all(dev);

dt_pthread_mutex_unlock(&dev->history_mutex);

// Signal after releasing history_mutex to avoid deadlock: raising
// DT_SIGNAL_DEVELOP_HISTORY_CHANGE while holding history_mutex can trigger
// signal handlers (e.g. neural_restore) that call dt_control_get_mouse_over_id,
// which acquires global_mutex — conflicting with dt_dev_zoom_move and
// dt_dev_get_viewport_params which hold global_mutex and then acquire history_mutex.
if(need_end_record)
dt_dev_undo_end_record(dev);

dt_pthread_mutex_unlock(&dev->history_mutex);

if(dev->gui_attached)
{
/* signal that history has changed */
Expand Down
Loading
Loading