Bug 897452 - Part 5 - Fix a TextureClient gtest crash - r=BenWa

This commit is contained in:
Nicolas Silva 2013-12-11 20:44:51 -05:00
parent bffd72633e
commit 067ae770a6
2 changed files with 4 additions and 10 deletions

View File

@ -368,8 +368,8 @@ MemoryTextureClient::MemoryTextureClient(CompositableClient* aCompositable,
MemoryTextureClient::~MemoryTextureClient()
{
MOZ_COUNT_DTOR(MemoryTextureClient);
if (ShouldDeallocateInDestructor() && mBuffer) {
// if the buffer has never been shared we must deallocate it or ir would
if (mBuffer && ShouldDeallocateInDestructor()) {
// if the buffer has never been shared we must deallocate it or it would
// leak.
GfxMemoryImageReporter::WillFree(mBuffer);
delete mBuffer;

View File

@ -142,9 +142,6 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface)
hostDataSurface->Stride(),
SurfaceFormatToImageFormat(hostDataSurface->GetFormat()));
AssertSurfacesEqual(surface, hostSurface.get());
// host deallocation
host->DeallocateSharedData();
}
// Same as above, for YCbCr surfaces
@ -207,9 +204,6 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) {
AssertYCbCrSurfacesEqual(&ycbcrData, &data);
host->Unlock();
// host deallocation
host->DeallocateSharedData();
}
TEST(Layers, TextureSerialization) {
@ -228,7 +222,7 @@ TEST(Layers, TextureSerialization) {
RefPtr<TextureClient> client
= new MemoryTextureClient(nullptr,
mozilla::gfx::ImageFormatToSurfaceFormat(surface->Format()),
TEXTURE_FLAGS_DEFAULT);
TEXTURE_DEALLOCATE_CLIENT);
TestTextureClientSurface(client, surface);
@ -264,7 +258,7 @@ TEST(Layers, TextureYCbCrSerialization) {
RefPtr<TextureClient> client
= new MemoryTextureClient(nullptr,
mozilla::gfx::FORMAT_YUV,
TEXTURE_FLAGS_DEFAULT);
TEXTURE_DEALLOCATE_CLIENT);
TestTextureClientYCbCr(client, clientData);