[android] release local refs early

This commit is contained in:
Ivo van Dongen
2018-04-05 16:14:22 +03:00
committed by Ivo van Dongen
parent 1af1cbe721
commit 14423a225b
2 changed files with 7 additions and 1 deletions

View File

@@ -16,7 +16,12 @@ PremultipliedImage decodeImage(const std::string& string) {
reinterpret_cast<const signed char*>(string.data()));
auto bitmap = android::BitmapFactory::DecodeByteArray(*env, array, 0, string.size());
return android::Bitmap::GetImage(*env, bitmap);
jni::DeleteLocalRef(*env, array);
auto image = android::Bitmap::GetImage(*env, bitmap);
jni::DeleteLocalRef(*env, bitmap);
return image;
}
} // namespace mbgl