From 574ede0541d1eae9f71c2b63331f393927b983d5 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Mon, 7 Oct 2019 01:36:05 -0700 Subject: [PATCH] avm1: Return proper root object for Avm1::root_object Was returning start_clip instead. Also call DisplayObject::post_instantiation for root after it's created in Player::new. --- core/src/avm1.rs | 2 +- core/src/player.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/avm1.rs b/core/src/avm1.rs index a590fe242..0ebe0e9b2 100644 --- a/core/src/avm1.rs +++ b/core/src/avm1.rs @@ -986,7 +986,7 @@ impl<'gc> Avm1<'gc> { /// Obtain the value of `_root`. pub fn root_object(&self, context: &mut ActionContext<'_, 'gc, '_>) -> Value<'gc> { - context.start_clip.read().object() + context.root.read().object() } /// Obtain the value of `_global`. diff --git a/core/src/player.rs b/core/src/player.rs index b1f004e2e..50f9c9911 100644 --- a/core/src/player.rs +++ b/core/src/player.rs @@ -127,6 +127,13 @@ impl is_mouse_down: false, }; + player.gc_arena.mutate(|gc_context, gc_root| { + gc_root + .root + .write(gc_context) + .post_instantiation(gc_context, gc_root.root) + }); + player.build_matrices(); player.preload();