From 8ec76186334df9dc87fc8aa7aa5edc84d977d776 Mon Sep 17 00:00:00 2001 From: sotaro Date: Fri, 14 Feb 2020 10:46:53 +0100 Subject: [Layers] Clear WrappingTextureSourceYCbCrBasic::mTexture correctly --- gfx/layers/composite/TextureHost.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index b342f1d18..8df7af4a8 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -555,6 +555,14 @@ void BufferTextureHost::DeallocateDeviceData() { if (mFirstSource && mFirstSource->NumCompositableRefs() > 0) { + // WrappingTextureSourceYCbCrBasic wraps YUV format BufferTextureHost. + // When BufferTextureHost is destroyed, data of + // WrappingTextureSourceYCbCrBasic becomes invalid. + if (mFirstSource->AsWrappingTextureSourceYCbCrBasic() && + mFirstSource->IsOwnedBy(this)) { + mFirstSource->SetOwner(nullptr); + mFirstSource->DeallocateDeviceData(); + } return; } -- cgit v1.2.3