core: Clear masker/maskee properties when unloading objects

This commit is contained in:
desuwa 2021-02-28 12:26:59 +01:00 committed by Mike Welsh
parent b586c7f74e
commit 0d98fe8b7c
4 changed files with 23 additions and 0 deletions

View File

@ -990,6 +990,12 @@ pub trait TDisplayObject<'gc>:
} }
} }
if let Some(node) = self.maskee() {
node.set_masker(context.gc_context, None, true);
} else if let Some(node) = self.masker() {
node.set_maskee(context.gc_context, None, true);
}
// Unregister any text field variable bindings, and replace them on the unbound list. // Unregister any text field variable bindings, and replace them on the unbound list.
if let Avm1Value::Object(object) = self.object() { if let Avm1Value::Object(object) = self.object() {
if let Some(stage_object) = object.as_stage_object() { if let Some(stage_object) = object.as_stage_object() {

View File

@ -517,6 +517,11 @@ impl<'gc> TDisplayObject<'gc> for Button<'gc> {
let tracker = context.focus_tracker; let tracker = context.focus_tracker;
tracker.set(None, context); tracker.set(None, context);
} }
if let Some(node) = self.maskee() {
node.set_masker(context.gc_context, None, true);
} else if let Some(node) = self.masker() {
node.set_maskee(context.gc_context, None, true);
}
self.set_removed(context.gc_context, true); self.set_removed(context.gc_context, true);
} }
} }

View File

@ -1500,6 +1500,12 @@ impl<'gc> TDisplayObject<'gc> for EditText<'gc> {
tracker.set(None, context); tracker.set(None, context);
} }
if let Some(node) = self.maskee() {
node.set_masker(context.gc_context, None, true);
} else if let Some(node) = self.masker() {
node.set_maskee(context.gc_context, None, true);
}
// Unbind any display objects bound to this text. // Unbind any display objects bound to this text.
if let Some(stage_object) = self.0.write(context.gc_context).bound_stage_object.take() { if let Some(stage_object) = self.0.write(context.gc_context).bound_stage_object.take() {
stage_object.clear_text_field_binding(context.gc_context, *self); stage_object.clear_text_field_binding(context.gc_context, *self);

View File

@ -1987,6 +1987,12 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
child.unload(context); child.unload(context);
} }
if let Some(node) = self.maskee() {
node.set_masker(context.gc_context, None, true);
} else if let Some(node) = self.masker() {
node.set_maskee(context.gc_context, None, true);
}
// Unregister any text field variable bindings. // Unregister any text field variable bindings.
if let Avm1Value::Object(object) = self.object() { if let Avm1Value::Object(object) = self.object() {
if let Some(stage_object) = object.as_stage_object() { if let Some(stage_object) = object.as_stage_object() {