Bug 860442. Delete the gralloc buffer even when we don't have a PBufferParent. r=nical
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 11 Apr 2013 19:57:28 -0400
changeset 128525 fe2fe1ad36d9c5f98ba992f75cb8eec52bebd791
parent 128524 c4bac10ee49e73a8c60dfaf817eab1e751f2f1d5
child 128526 350baac4bbdb70b6579e48c35102c2fccca41adb
push id26365
push userjmuizelaar@mozilla.com
push dateFri, 12 Apr 2013 00:06:23 +0000
treeherdermozilla-inbound@fe2fe1ad36d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs860442
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 860442. Delete the gralloc buffer even when we don't have a PBufferParent. r=nical We can allocate surfaces on the child and the parent so we should be able to delete them both.
gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
--- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
@@ -264,19 +264,28 @@ GrallocBufferActor::Create(const gfxIntS
 
 bool
 ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
 {
   if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aSurface->type()) {
     return false;
   }
 
+  // we should have either a bufferParent or bufferChild
+  // depending on whether we're on the parent or child side.
   PGrallocBufferParent* gbp =
     aSurface->get_SurfaceDescriptorGralloc().bufferParent();
-  unused << PGrallocBufferParent::Send__delete__(gbp);
+  if (gbp) {
+    unused << PGrallocBufferParent::Send__delete__(gbp);
+  } else {
+    PGrallocBufferChild* gbc =
+      aSurface->get_SurfaceDescriptorGralloc().bufferChild();
+    unused << PGrallocBufferChild::Send__delete__(gbc);
+  }
+
   *aSurface = SurfaceDescriptor();
   return true;
 }
 
 //-----------------------------------------------------------------------------
 // Child process
 
 /*static*/ PGrallocBufferChild*