Fixes race condition during mask resizing#21102
Merged
Merged
Conversation
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.
Fixes race condition between the pixelpipe worker thread and the UI thread accessing
dev->formsconcurrently.Crash report (txt)
During a mask resize operation, the call chain in the pixelpipe worker is:
At blend.c:595, the outer form is correctly fetched from
piece->pipe->forms— a deep copy ofdev->formsmade at the start of the pipeline run (pixelpipe_hb.c:3092):But when
_group_get_mask_roineeds to look up child forms (the shapes inside a group), it bypasses the pipe's copy and goes directly todev->forms:The same bug exists in
_group_get_maskat group.c:333.While the pixelpipe worker iterates over a child path form's
form->pointsGList in_path_get_pts_border, the UI thread (responding to a mouse resize) can modify that same GList indev->forms— freeing or relocating nodes. When the worker thread then follows a->nextpointer on a freed GList node, it reads address0x0000000000000008(GList.next is at offset 8 on 64-bit) and crashes.Fix
Changed both unsafe lookups from
dev->formstopiece->pipe->formsusingdt_masks_get_from_id_ext:group.c:333 (in
_group_get_mask):group.c:651 (in
_group_get_mask_roi):Both functions already have
pieceas a parameter withpiece->pipe->formsavailable.dt_masks_get_from_id_extalready exists and takes exactly aGList *(the forms list) — it's already used correctly inblend.c:595for the outer form lookup.Co-authored with Claude.