summaryrefslogtreecommitdiffstats
path: root/gfx/layers/composite/ImageLayerComposite.cpp
diff options
context:
space:
mode:
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 79a444b..a21ce22 100644
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -47,9 +47,14 @@ ImageLayerComposite::~ImageLayerComposite() {
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;
}