Bug 844289 - Guard against missing Surface.mNativeSurface on Android r=kats

This commit is contained in:
James Willcox
2013-02-26 09:28:57 -05:00
parent 964e810c4f
commit fbad24c6d9
2 changed files with 19 additions and 3 deletions

View File

@@ -15,9 +15,14 @@ using namespace mozilla;
static jfieldID jEGLSurfacePointerField = 0;
void AndroidEGLObject::Init(JNIEnv* aJEnv) {
AutoLocalJNIFrame jniFrame(aJEnv);
jclass jClass;
jClass = reinterpret_cast<jclass>
(aJEnv->NewGlobalRef(aJEnv->FindClass("com/google/android/gles_jni/EGLSurfaceImpl")));
if (!jClass)
return;
jEGLSurfacePointerField = aJEnv->GetFieldID(jClass, "mEGLSurface", "I");
}
@@ -58,6 +63,10 @@ EGLSurface
AndroidGLController::ProvideEGLSurface()
{
ASSERT_THREAD();
if (!jEGLSurfacePointerField)
return NULL;
AutoLocalJNIFrame jniFrame(mJEnv);
jobject jObj = mJEnv->CallObjectMethod(mJObj, jProvideEGLSurfaceMethod);
if (jniFrame.CheckForException() || !jObj)