[AI] Fix object mask retaining stale state after image navigation#20571
Merged
TurboGit merged 2 commits intodarktable-org:masterfrom Mar 19, 2026
Merged
[AI] Fix object mask retaining stale state after image navigation#20571TurboGit merged 2 commits intodarktable-org:masterfrom
TurboGit merged 2 commits intodarktable-org:masterfrom
Conversation
|
IMO the selection (red overlay) or object mask should also be cleared at module reset. |
Contributor
Author
@pehar1 : Very good point. Thank you. |
Contributor
Author
Fixed in the latest push. The object mask scratchpad (which holds the mask overlay, brush state, and encoding) now detects when a new creation session starts on a different module and clears the stale mask/brush state while keeping the cached encoding (so re-encoding is not needed). |
Member
|
This PR needs conflict resolutions. TIA. |
751f1b1 to
e7531e9
Compare
Contributor
Author
Resolved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When creating an AI object mask, if the user navigates to another image and returns, the mask refinement state from the previous session persists instead of starting fresh.
Root cause
The object mask scratchpad survives image switches -
_free_datais only called on mask commit (right-click/Enter), not on image change. The existing image change detection comparesencoded_imgidvscur_imgid, which are equal when returning to the same image, so the reset block is skipped.Fix
Track the last seen image ID in
post_expose. When it differs from the current image, the user navigated away. This triggers the existing reset block, clearing encoding, mask, brush, and preview state so the next mask session starts fresh.