core: Always instantiate a new movie's library before creating it's root movieclip.

This commit is contained in:
David Wendt 2020-10-05 22:24:59 -04:00 committed by Mike Welsh
parent 7c719bfb0c
commit 693e56dc67
2 changed files with 5 additions and 0 deletions

View File

@ -461,6 +461,8 @@ impl<'gc> Loader<'gc> {
.lock() .lock()
.expect("Could not lock player!!") .expect("Could not lock player!!")
.update(|uc| { .update(|uc| {
uc.library.library_for_movie_mut(movie.clone());
let (clip, broadcaster) = match uc.load_manager.get_loader(handle) { let (clip, broadcaster) = match uc.load_manager.get_loader(handle) {
Some(Loader::Movie { Some(Loader::Movie {
target_clip, target_clip,

View File

@ -338,8 +338,11 @@ impl Player {
self.instance_counter = 0; self.instance_counter = 0;
self.mutate_with_update_context(|context| { self.mutate_with_update_context(|context| {
context.library.library_for_movie_mut(context.swf.clone());
let root: DisplayObject = let root: DisplayObject =
MovieClip::from_movie(context.gc_context, context.swf.clone()).into(); MovieClip::from_movie(context.gc_context, context.swf.clone()).into();
root.set_depth(context.gc_context, 0); root.set_depth(context.gc_context, 0);
root.post_instantiation(context, root, None, Instantiator::Movie, false); root.post_instantiation(context, root, None, Instantiator::Movie, false);
root.set_name(context.gc_context, ""); root.set_name(context.gc_context, "");