EMSUSDC-376 Filter out stale field data when restoring state#4559
Open
EMSUSDC-376 Filter out stale field data when restoring state#4559
Conversation
pierrebai-adsk
previously approved these changes
Mar 27, 2026
695d531 to
54feb7c
Compare
|
|
||
| SetField(path, fieldName, inverse); | ||
| // New invert — clear stale tracking from the previous one. | ||
| if (_invertCount != _lastInvertCount) { |
Collaborator
There was a problem hiding this comment.
IDK if the invert count is unchnaged could we optimize by not doing work?
Collaborator
Author
There was a problem hiding this comment.
I am not sure i get what you mean - if the count is unchanged it just means that we are within the same inversion sequence, i..e the same batch of operations, the same undo or redo (one undo/redo almost always is a sequence of invert functions) .Between inversion sequences, the state is always supposed to be ok, but within an invert sequence there can be bad state. If the count is unchanged, we still need to do what is below here (especially the setField), and only in the case spelled out do we need to filter out anything. But yeah... maybe i misunderstand what you mean!
pierrebai-adsk
approved these changes
Mar 29, 2026
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.
This fixes the undo/redo crashes when editing components, when ''dragging'' attributes in the attr editor.
When some edits are made outside of an undo block, and undo/redo is perfomed, the state is not always what is expected by the invert function, and restoring data can corrupt layers, leading to crashes on traversal later. The fix here is to find & remove stale info before it causes trouble.