summaryrefslogtreecommitdiffstats
path: root/gfx/layers/composite/ImageLayerComposite.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 15:18:04 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 15:18:04 +0200
commit9b655e3666a6eae6f217e584ef3915c8ff99ddc1 (patch)
tree31861f345384317ea7a99e1520e24519f9c07304 /gfx/layers/composite/ImageLayerComposite.cpp
parent65991dc1f2d197bed4657780d7f3b0204a78bb4e (diff)
downloadUXP-9b655e3666a6eae6f217e584ef3915c8ff99ddc1.tar
UXP-9b655e3666a6eae6f217e584ef3915c8ff99ddc1.tar.gz
UXP-9b655e3666a6eae6f217e584ef3915c8ff99ddc1.tar.lz
UXP-9b655e3666a6eae6f217e584ef3915c8ff99ddc1.tar.xz
UXP-9b655e3666a6eae6f217e584ef3915c8ff99ddc1.zip
Make extra sure Compositables don't refer back to layers after reassignment.
Diffstat (limited to 'gfx/layers/composite/ImageLayerComposite.cpp')
-rw-r--r--gfx/layers/composite/ImageLayerComposite.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp
index bac9f3790..6867aaa22 100644
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -50,9 +50,14 @@ bool
ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
{
switch (aHost->GetType()) {
- case CompositableType::IMAGE:
- mImageHost = static_cast<ImageHost*>(aHost);
+ case CompositableType::IMAGE: {
+ ImageHost* newImageHost = static_cast<ImageHost*>(aHost);
+ if (mImageHost && newImageHost != mImageHost) {
+ mImageHost->Detach(this);
+ }
+ mImageHost = newImageHost;
return true;
+ }
default:
return false;
}