core: Fix panic on unsetting self-referential masker

This commit is contained in:
Adrian Wielgosik 2024-07-12 21:49:14 +02:00 committed by Adrian Wielgosik
parent 261ba7374e
commit 48db0e23c4
5 changed files with 21 additions and 2 deletions

View File

@ -1666,7 +1666,8 @@ pub trait TDisplayObject<'gc>:
remove_old_link: bool,
) {
if remove_old_link {
if let Some(old_masker) = self.base().masker() {
let old_masker = self.base().masker();
if let Some(old_masker) = old_masker {
old_masker.set_maskee(gc_context, None, false);
}
if let Some(parent) = self.parent() {
@ -1686,7 +1687,8 @@ pub trait TDisplayObject<'gc>:
remove_old_link: bool,
) {
if remove_old_link {
if let Some(old_maskee) = self.base().maskee() {
let old_maskee = self.base().maskee();
if let Some(old_maskee) = old_maskee {
old_maskee.set_masker(gc_context, None, false);
}
self.invalidate_cached_bitmap(gc_context);

View File

@ -0,0 +1,14 @@
// compiled with mxmlc
package {
import flash.display.MovieClip;
public class Test extends MovieClip {
public function Test(){
var mc = new MovieClip();
this.mask = this;
this.mask = mc;
}
}
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
# tests a probable (no access to original repro) cause of
# https://github.com/ruffle-rs/ruffle/issues/14747
num_frames = 1