21918: ashift: lock when reading buffer geometry from GTK thread - #22198
Open
kofa73 wants to merge 1 commit into
Open
21918: ashift: lock when reading buffer geometry from GTK thread#22198kofa73 wants to merge 1 commit into
kofa73 wants to merge 1 commit into
Conversation
ralfbrown
reviewed
Sep 8, 2026
ralfbrown
left a comment
Collaborator
There was a problem hiding this comment.
Looks reasonable on a quick skim. I'll give it a try tomorrow.
Collaborator
Author
|
Rebased, no other change |
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.
ashift: read preview geometry under gui_lock
Fixes #21918
The issue:
The preview pipe writes its buffer geometry under
gui_lock, but several GUI readers access it without locking. A concurrent update can mix dimensions from different preview runs, affecting the crop outline or automatic crop.The issue was found by source analysis, @wpferguson then reported high reproduction rate via Lua (he had run into the issue earlier).
The fix:
dt_iop_gui_enter_critical_section()/dt_iop_gui_leave_critical_section()pair to acquire and releasegui_lock.dt_iop_ashift_bufgeom_tstruct, then use that local snapshot.isflippedreaders.The new helpers release the lock before fitting, drawing, or history updates.
Testing:
no longer reproduces with the Lua script
AI:
Coded by Claude Code; reviewed by Codex.