core: Ensure empty movie clips are born preloaded.

An "empty clip" is any clip created by the `new` or `new_with_avm2` function, intended for dynamically-created movie clips with no association to a movie symbol.
This commit is contained in:
David Wendt 2021-07-28 19:57:44 -04:00 committed by kmeisthax
parent f96017e6f3
commit 3a265adcc4
2 changed files with 5 additions and 3 deletions

View File

@ -33,8 +33,6 @@ pub fn instance_init<'gc>(
let new_do = let new_do =
MovieClip::new_with_avm2(movie, this, class_object, activation.context.gc_context); MovieClip::new_with_avm2(movie, this, class_object, activation.context.gc_context);
new_do.preload(&mut activation.context, &mut Default::default(), None);
this.init_display_object(activation.context.gc_context, new_do.into()); this.init_display_object(activation.context.gc_context, new_do.into());
} }
} }

View File

@ -3812,7 +3812,11 @@ struct MovieClipStatic<'gc> {
impl<'gc> MovieClipStatic<'gc> { impl<'gc> MovieClipStatic<'gc> {
fn empty(movie: Arc<SwfMovie>, gc_context: MutationContext<'gc, '_>) -> Self { fn empty(movie: Arc<SwfMovie>, gc_context: MutationContext<'gc, '_>) -> Self {
Self::with_data(0, SwfSlice::empty(movie), 1, None, gc_context) let s = Self::with_data(0, SwfSlice::empty(movie), 1, None, gc_context);
s.preload_progress.write(gc_context).cur_preload_frame = s.total_frames + 1;
s
} }
fn with_data( fn with_data(