Permalink
Browse files

Fix WebpBitmapFactoryImpl.createBitmap() being called with wrong class

Summary:
When JNI debugging is enabled, ART is very pedantic about what class you are passing when invoking static method. In this case, this is causing a crash:

runtime.cc:476] JNI DETECTED ERROR IN APPLICATION: can't call static android.graphics.Bitmap com.facebook.webpsupport.WebpBitmapFactoryImpl.createBitmap(int, int, android.graphics.BitmapFactory$Options) with class java.lang.Class<android.graphics.Bitmap>
runtime.cc:476]     in call to CallStaticObjectMethodV
runtime.cc:476]     from android.graphics.Bitmap com.facebook.webpsupport.WebpBitmapFactoryImpl.nativeDecodeByteArray(byte[], int, int, android.graphics.BitmapFactory$Options, float, byte[])
Closes #1607

Reviewed By: massimocarli, oprisnik

Differential Revision: D4386800

Pulled By: foghina

fbshipit-source-id: 876e0fb944ebb42f5ace242b67f119c57ca2464a
  • Loading branch information...
1 parent a4bec85 commit 1d4461d9afc549380cc1a9b7f58460e44a75f9f1 @korDen korDen committed with facebook-github-bot Jan 9, 2017
Showing with 1 addition and 1 deletion.
  1. +1 −1 static-webp/src/main/jni/static-webp/webp_bitmapfactory.cpp
@@ -95,7 +95,7 @@ static void setBitmapSize(JNIEnv* env, jobject bitmapOptions, int image_width, i
}
static jobject createBitmap(JNIEnv* env, int image_width, int image_height, jobject bitmapOptions) {
- jobject bitmap = env->CallStaticObjectMethod(bitmapClass, createBitmapFunction, image_width, image_height, bitmapOptions);
+ jobject bitmap = env->CallStaticObjectMethod(webpBitmapFactoryClass, createBitmapFunction, image_width, image_height, bitmapOptions);
return bitmap;
}

0 comments on commit 1d4461d

Please sign in to comment.