Skip to content

Commit

Permalink
avm1: When unloading a button, also unload its children
Browse files Browse the repository at this point in the history
  • Loading branch information
Toad06 authored and torokati44 committed Nov 9, 2024
1 parent 99f6b22 commit 50df827
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/display_object/avm1_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,12 @@ impl<'gc> TDisplayObject<'gc> for Avm1Button<'gc> {
}

fn avm1_unload(&self, context: &mut UpdateContext<'gc>) {
for child in self.iter_render_list() {
child.avm1_unload(context);
}

self.drop_focus(context);

if let Some(node) = self.maskee() {
node.set_masker(context.gc(), None, true);
} else if let Some(node) = self.masker() {
Expand Down
4 changes: 4 additions & 0 deletions tests/tests/swfs/avm1/movieclip_in_removed_button/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_level0.button.instance1.onEnterFrame
_level0.button
undefined
undefined
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_frames = 4

0 comments on commit 50df827

Please sign in to comment.