From 5474f3396a963196fa6dc05add85429e2358ec1a Mon Sep 17 00:00:00 2001 From: Thierry Strudel Date: Fri, 22 Aug 2014 11:19:09 -0700 Subject: [PATCH] SurfaceControl: free ref when not used anymore C standard does not ensure order in which arguments are evaluated leading to faulty behavior in x86 case. Bug: 17206275 Change-Id: I6553c55bcf646d93413135aed733f20b91852735 Signed-off-by: Thierry Strudel --- core/jni/android_view_SurfaceControl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 3fb084a79d439..8f30f5d0430aa 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -180,7 +180,8 @@ static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz, // takes ownership of ScreenshotClient SkMallocPixelRef* pixels = SkMallocPixelRef::NewWithProc(screenshotInfo, (size_t) rowBytes, NULL, (void*) screenshot->getPixels(), &DeleteScreenshot, - (void*) (screenshot.detach())); + (void*) (screenshot.get())); + screenshot.detach(); pixels->setImmutable(); bitmap->setPixelRef(pixels)->unref(); bitmap->lockPixels();