diff options
Diffstat (limited to 'gfx/layers/composite/ImageLayerComposite.cpp')
-rw-r--r-- | gfx/layers/composite/ImageLayerComposite.cpp | 9 |
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; } |