Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avm1: Do not panic when swapping children on depth/render list desync #19594

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Feb 22, 2025

Unfortunately sometimes the render list and the depth list become desynchronized. When swapping children this caused panics.

I haven't been able to reproduce those scenarios, but it's better to leave the render/depth list messed up than to panic in this case.

@kjarosh kjarosh added A-avm1 Area: AVM1 (ActionScript 1 & 2) T-fix Type: Bug fix (in something that's supposed to work already) waiting-on-review Waiting on review from a Ruffle team member labels Feb 22, 2025
.unwrap();
self.render_list_mut().insert(new_position + 1, child);
.map(|pos| pos + 1)
.unwrap_or(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be better for this to log an error instead of inserting it at position 0 if the DO wasn't in the render list?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added an error, although it won't tell us much, only that a desync happened and we should expect depth list and render list to not be in sync. We would have to add debug checks during mutation to get useful errors or panics.

I'll also be trying to refactor this in the future so that the desync is less likely / impossible to happen.

Unfortunately sometimes the render list and the depth list become
desynchronized.  When swapping children this caused panics.

I haven't been able to reproduce those scenarios, but it's better to
leave the render/depth list messed up than to panic in this case.
@kjarosh kjarosh force-pushed the swap-at-depth-crash branch from 0c6d535 to 69b96c4 Compare March 5, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment