Skip to content

EMSUSDC-376 Filter out stale field data when restoring state#4559

Open
deboisj wants to merge 1 commit intodevfrom
deboisj/fix_undo_crash_clean
Open

EMSUSDC-376 Filter out stale field data when restoring state#4559
deboisj wants to merge 1 commit intodevfrom
deboisj/fix_undo_crash_clean

Conversation

@deboisj
Copy link
Copy Markdown
Collaborator

@deboisj deboisj commented Mar 27, 2026

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.

@deboisj deboisj assigned deboisj and unassigned deboisj Mar 27, 2026
@deboisj deboisj requested a review from pierrebai-adsk March 27, 2026 18:30
@deboisj deboisj self-assigned this Mar 27, 2026
@deboisj deboisj changed the title Filter out stale field when restoring state Filter out stale field data when restoring state Mar 27, 2026
@deboisj deboisj changed the title Filter out stale field data when restoring state EMSUSDC-360 Filter out stale field data when restoring state Mar 27, 2026
@deboisj deboisj changed the title EMSUSDC-360 Filter out stale field data when restoring state EMSUSDC-376 Filter out stale field data when restoring state Mar 27, 2026
@deboisj deboisj requested a review from seando-adsk March 27, 2026 18:58
pierrebai-adsk
pierrebai-adsk previously approved these changes Mar 27, 2026
@deboisj deboisj force-pushed the deboisj/fix_undo_crash_clean branch from 695d531 to 54feb7c Compare March 28, 2026 18:41
@deboisj deboisj assigned deboisj and unassigned deboisj Mar 28, 2026

SetField(path, fieldName, inverse);
// New invert — clear stale tracking from the previous one.
if (_invertCount != _lastInvertCount) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK if the invert count is unchnaged could we optimize by not doing work?

Copy link
Copy Markdown
Collaborator Author

@deboisj deboisj Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants