Fix Cannot read properties of undefined (reading 'occluded')#10853
Open
klakhov wants to merge 3 commits into
Open
Fix Cannot read properties of undefined (reading 'occluded')#10853klakhov wants to merge 3 commits into
Cannot read properties of undefined (reading 'occluded')#10853klakhov wants to merge 3 commits into
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.
Motivation and context
Fixes a crash when placing a pasted mask if the brush toolset is reconfigured while the paste is still in progress:
Reproduction:
Root cause: pasting a mask starts the insertion pipeline in
MasksHandlerImpl.draw(), which setsisInsertion = trueand storesthis.drawData(containinginitialState). While that insertion is still live, the brush toolset legitimately re-issuescanvasInstance.draw({ enabled: true, shapeType: 'mask', ... })on brush size/tool changes but withoutinitialState. That second call fell through to the drawing branch and unconditionally ranthis.drawData = drawData, wiping outinitialStatewhileisInsertionstayedtrue. The nextmouse:downthen readthis.drawData.initialState.occludedonundefinedand threw.This only affects masks because they are the only shape whose toolset reconfigures the active
draw()mid-insertion; insertion also reports asMode.DRAW, so only the canvas (which owns the privateisInsertionflag) can distinguish a paste from a fresh draw. The fix therefore lives incvat-canvasand makesdraw()robust to reconfiguration calls during an active insertion:drawData(and itsinitialState) until the insertion actually ends.Checklist
developbranchLicense