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 391bb42..3f1c2db 100644
--- a/gfx/layers/composite/PaintedLayerComposite.cpp
+++ b/gfx/layers/composite/PaintedLayerComposite.cpp
@@ -47,9 +47,14 @@ bool 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;
}