Make extra sure Compositables don't refer back to layers after reassignment.

This commit is contained in:
wolfbeast 2019-05-28 15:18:04 +02:00 committed by Roy Tam
commit 706ac5f0a4
3 changed files with 19 additions and 5 deletions

View file

@ -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;
}