From 4ad94cfde9ffbb8b32b461ed288327e17ea936c9 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 28 May 2019 15:18:04 +0200 Subject: Make extra sure Compositables don't refer back to layers after reassignment. --- gfx/layers/composite/CanvasLayerComposite.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gfx/layers/composite/CanvasLayerComposite.cpp') diff --git a/gfx/layers/composite/CanvasLayerComposite.cpp b/gfx/layers/composite/CanvasLayerComposite.cpp index 3c8299e05..86f25b1ee 100644 --- a/gfx/layers/composite/CanvasLayerComposite.cpp +++ b/gfx/layers/composite/CanvasLayerComposite.cpp @@ -43,9 +43,13 @@ bool CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost) { switch (aHost->GetType()) { - case CompositableType::IMAGE: + case CompositableType::IMAGE: { + if (mCompositableHost && aHost != mCompositableHost) { + mCompositableHost->Detach(this); + } mCompositableHost = aHost; return true; + } default: return false; } -- cgit v1.2.3