Skip to content

iop/watermark: only unset mipmap hash when watermark is enabled - #22315

Merged
TurboGit merged 1 commit into
darktable-org:masterfrom
radialmonster:agent/watermark-invalidate-only-when-enabled
Sep 17, 2026
Merged

TurboGit merged 1 commit into
darktable-org:masterfrom
radialmonster:agent/watermark-invalidate-only-when-enabled

Conversation

@radialmonster

@radialmonster radialmonster commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Fixes the thumbnail-regeneration regression from #22103 for images
that don't use the watermark module: its metadata/tag signal callbacks
are connected in every darkroom session, not just when watermark is
enabled.

This checks self->enabled at the callback boundary, so a disabled
watermark skips both dt_iop_refresh_all() and
dt_history_hash_unset_mipmap(). Images without watermark enabled keep
a synced hash and stop regenerating their thumbnail on every darkroom
visit.

Built and tested against current master: no-op darkroom visits for
images without watermark remain synced and do not regenerate their
thumbnail. Images with watermark enabled still regenerate on every
visit after this change; this was flagged and accepted as a known
tradeoff in the discussion on #22103.

Prepared with AI assistance.

@TurboGit

Copy link
Copy Markdown
Member

Hum, why still dt_iop_refresh_all()?

I would have done that:

diff --git a/src/iop/watermark.c b/src/iop/watermark.c
index 646e0c80a6..3e62b9e1b8 100644
--- a/src/iop/watermark.c
+++ b/src/iop/watermark.c
@@ -1405,13 +1405,13 @@ static void _metadata_changed(gpointer instance,
                               const int type,
                               dt_iop_module_t *self)
 {
-  if(self) _invalidate_tag_meta(self);
+  if(self && self.enabled) _invalidate_tag_meta(self);
 }
 
 static void _tag_changed(gpointer instance,
                          dt_iop_module_t *self)
 {
-  if(self) _invalidate_tag_meta(self);
+  if(self && self.enabled) _invalidate_tag_meta(self);
 }

@TurboGit TurboGit added this to the 5.8 milestone Sep 17, 2026
@TurboGit TurboGit added bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes scope: image processing correcting pixels scope: DAM managing files, collections, archiving, metadata, etc. labels Sep 17, 2026
@radialmonster

Copy link
Copy Markdown
Contributor Author

I kept the change deliberately narrow and guarded only the operation causing the reported regression, preserving the existing dt_iop_refresh_all() behavior from #22103. But you’re right: when the module is disabled, there is no watermark output to refresh either, so checking self->enabled in the callbacks is cleaner. I’ll update it that way.

The watermark module receives metadata and tag change signals in every darkroom session, even when it is disabled. Refreshing its pixelpipe cache and clearing mipmap_hash then causes unnecessary work and repeated thumbnail generation.

Ignore both signals while the module is disabled. This keeps enabled watermark text responsive to metadata changes while avoiding invalidation for other images.

Regression from darktable-org#22103, unreleased.
@radialmonster
radialmonster force-pushed the agent/watermark-invalidate-only-when-enabled branch from b33619f to 9d2993a Compare September 17, 2026 16:46

@TurboGit TurboGit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit
TurboGit merged commit 43f4471 into darktable-org:master Sep 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes scope: DAM managing files, collections, archiving, metadata, etc. scope: image processing correcting pixels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants