Fix another collision shape editor crash #76798
Merged
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.
The collision shape editor checks in
NOTIFICATION_PROCESS
if the shape has not changed. In theory it should ensure that the shape is valid before trying to draw it. But turns out, for whatever reason, and contrary to the "Clear" context menu option, the revert arrow will remove the shape somewhere betweenNOTIFICATION_PROCESS
and drawing function, which results in redraw with old data.The PR makes the draw method use the currently cached shape, which means that in the aforementioned corner-case, the editor will draw old shape for a single frame.
Of course an alternative is adding a null check for node's shape, but the
current_shape
is updated reliably, so why not use it.Fixes #76771