From 33db9b1f0b9d3b4cdbfbbe4b039b3187008c3b57 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Tue, 15 May 2012 18:30:15 -0400 Subject: [PATCH] Bug 755324 - Avoid JNI leak in AndroidGLController::ProvideEGLSurface. r=kats --- widget/android/AndroidLayerViewWrapper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/widget/android/AndroidLayerViewWrapper.cpp b/widget/android/AndroidLayerViewWrapper.cpp index 710d9272d77..a65b80b840e 100644 --- a/widget/android/AndroidLayerViewWrapper.cpp +++ b/widget/android/AndroidLayerViewWrapper.cpp @@ -36,8 +36,11 @@ * ***** END LICENSE BLOCK ***** */ #include "AndroidLayerViewWrapper.h" +#include "AndroidBridge.h" #include "nsDebug.h" +using namespace mozilla; + #define ASSERT_THREAD() \ NS_ASSERTION(pthread_self() == mThread, "Something is calling AndroidGLController from the wrong thread!") @@ -77,6 +80,7 @@ void AndroidGLController::SetGLVersion(int aVersion) { ASSERT_THREAD(); + AutoLocalJNIFrame jniFrame(mJEnv, 0); mJEnv->CallVoidMethod(mJObj, jSetGLVersionMethod, aVersion); } @@ -84,6 +88,7 @@ EGLSurface AndroidGLController::ProvideEGLSurface() { ASSERT_THREAD(); + AutoLocalJNIFrame jniFrame(mJEnv); jobject jObj = mJEnv->CallObjectMethod(mJObj, jProvideEGLSurfaceMethod); return reinterpret_cast(mJEnv->GetIntField(jObj, jEGLSurfacePointerField)); } @@ -92,5 +97,6 @@ void AndroidGLController::WaitForValidSurface() { ASSERT_THREAD(); + AutoLocalJNIFrame jniFrame(mJEnv, 0); mJEnv->CallVoidMethod(mJObj, jWaitForValidSurfaceMethod); }