From 00af5014972f948db58b4081aa7faed991655e8b Mon Sep 17 00:00:00 2001 From: Kofa Date: Sat, 19 Sep 2026 07:03:06 +0000 Subject: [PATCH 1/3] ashift: don't drop the deferred autocrop on an early preview signal A rotation change made while the module is still disabled defers the autocrop until the preview buffer exists. A preview-finished signal from a run that started before the module was enabled cleared the request, do_crop() bailed out on the empty buffer, and the crop was lost. Keep the request pending until the buffer is filled. Authored by Claude Code. Fixes #21513 --- src/iop/ashift.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/iop/ashift.c b/src/iop/ashift.c index b366762055a..f3e1beaf7a0 100644 --- a/src/iop/ashift.c +++ b/src/iop/ashift.c @@ -5561,6 +5561,14 @@ static void _event_process_after_preview_callback(gpointer instance, dt_iop_modu switch(jobcode) { case ASHIFT_JOBCODE_DO_CROP: + // the signal can come from a preview run that started before the + // module was enabled and so never filled g->buf; do_crop() would + // return without cropping, so keep the request for the next run + if(g->buf_width == 0 || g->buf_height == 0) + { + g->jobcode = ASHIFT_JOBCODE_DO_CROP; + break; + } do_crop(self, p); _commit_crop_box(p, g); // save all that From 581c83e448cf6247d005e560d695300d95ac6070 Mon Sep 17 00:00:00 2001 From: Kofa Date: Sat, 19 Sep 2026 07:03:06 +0000 Subject: [PATCH 2/3] RELEASE_NOTES.md: ashift autocrop lost on first rotation Authored by Claude Code. --- RELEASE_NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 8bc4b729a05..3bbb47daa4f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -337,6 +337,10 @@ changes (where available). - Fixed a crash on using tag floating window after editing metadata. +- Fixed rotate and perspective sometimes not applying its automatic + crop when the rotation was changed (e.g. with a shortcut) before the + module had been enabled, leaving empty corners in the image. + ## Lua ### API Version From 5e98e3ed47eaddbcfdd1b9e95aa61cf75a21d5e1 Mon Sep 17 00:00:00 2001 From: Kofa Date: Sat, 19 Sep 2026 12:17:17 +0000 Subject: [PATCH 3/3] ashift: take gui_lock for the deferred crop's buffer size check The preview pipe writes buf_width/buf_height under gui_lock on its worker thread; the check in the GTK-side callback read them unlocked. Authored by Claude Code. --- src/iop/ashift.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/iop/ashift.c b/src/iop/ashift.c index f3e1beaf7a0..bb7526398c6 100644 --- a/src/iop/ashift.c +++ b/src/iop/ashift.c @@ -5564,7 +5564,10 @@ static void _event_process_after_preview_callback(gpointer instance, dt_iop_modu // the signal can come from a preview run that started before the // module was enabled and so never filled g->buf; do_crop() would // return without cropping, so keep the request for the next run - if(g->buf_width == 0 || g->buf_height == 0) + dt_iop_gui_enter_critical_section(self); + const gboolean buf_empty = g->buf_width == 0 || g->buf_height == 0; + dt_iop_gui_leave_critical_section(self); + if(buf_empty) { g->jobcode = ASHIFT_JOBCODE_DO_CROP; break;