Skip to content

avm1: Incorrect path when accessing _root inside a button after removal #10238

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

Open
Herschel opened this issue Mar 19, 2023 · 0 comments
Open
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working

Comments

@Herschel
Copy link
Member

Herschel commented Mar 19, 2023

Place a movieclip inside a button with this code on the movieclip's frame 1:

tellTarget(_root) {
	gotoAndStop(2); // The button no longer exists on frame 2, so the button and child movieclip are removed
}
trace(_root); // Should trace _level0, but traces _level1 in Ruffle

Sample SWF:
incorrect-level.zip

MovieClipReference::process_swf5_references can no longer access _root and ends up returning None, and DisplayObject::path ends up incorrectly returning _level1 based on the depth of the movieclip. This probably affects other properties such as _parent as well.

There should probably be an assert that we're a root movie when we do "_level" + self.depth(), because non-root movieclips should never run that code. Also, it's probably worthwhile to investigate how this interacts exactly with loadMovieNum; if you load the above movie into _level20, does trace(_root); still output _level20 in the FP?

Related to #9885.

@Herschel Herschel added bug Something isn't working A-avm1 Area: AVM1 (ActionScript 1 & 2) labels Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant