[android] Fix crash if decode .heic image in 32bit mode android app. (flutter/engine#36859)
* [android] Fix crash if decode .heic image in 32bit mode android app. The type |long| is equal to int32_t in 32bit app, but int64_t in 64bit app. The type |jlong| is always equal to int64_t. CallStaticObjectMethod uses "J" to request a jlong type which needs 8 byte data but given |long| value which provides 4 byte data in 32bit mode will trigger java value error and at last a wrong pointer to AndroidImageGenerator object. Change-Id: I38cc46adc45d8bf3e4eb35e6e904e58ee0682d97 * fix compile error Change-Id: I7f9b089f7846b03c4b6f91f8cb9d141403e71483 * use reinterpret_cast<jlong> directly. Change-Id: I493a3ecb7cfbf9dc61cd8e69f418635480d4bb6b
This commit is contained in:
@@ -106,7 +106,7 @@ void AndroidImageGenerator::DoDecodeImage() {
|
||||
auto bitmap = std::make_unique<fml::jni::ScopedJavaGlobalRef<jobject>>(
|
||||
env, env->CallStaticObjectMethod(g_flutter_jni_class->obj(),
|
||||
g_decode_image_method, direct_buffer,
|
||||
reinterpret_cast<long>(this)));
|
||||
reinterpret_cast<jlong>(this)));
|
||||
FML_CHECK(fml::jni::CheckException(env));
|
||||
|
||||
if (bitmap->is_null()) {
|
||||
|
||||
Reference in New Issue
Block a user