summaryrefslogtreecommitdiffstats
path: root/gfx/layers/composite/PaintedLayerComposite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/composite/PaintedLayerComposite.cpp')
-rw-r--r--gfx/layers/composite/PaintedLayerComposite.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/gfx/layers/composite/PaintedLayerComposite.cpp b/gfx/layers/composite/PaintedLayerComposite.cpp
index b58f5d690..232cc4ef4 100644
--- a/gfx/layers/composite/PaintedLayerComposite.cpp
+++ b/gfx/layers/composite/PaintedLayerComposite.cpp
@@ -49,9 +49,14 @@ PaintedLayerComposite::SetCompositableHost(CompositableHost* aHost)
switch (aHost->GetType()) {
case CompositableType::CONTENT_TILED:
case CompositableType::CONTENT_SINGLE:
- case CompositableType::CONTENT_DOUBLE:
- mBuffer = static_cast<ContentHost*>(aHost);
+ case CompositableType::CONTENT_DOUBLE: {
+ ContentHost* newBuffer = static_cast<ContentHost*>(aHost);
+ if (mBuffer && newBuffer != mBuffer) {
+ mBuffer->Detach(this);
+ }
+ mBuffer = newBuffer;
return true;
+ }
default:
return false;
}