Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] release local refs early
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed Apr 9, 2018
1 parent 1af1cbe commit 14423a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion platform/android/src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions platform/android/src/text/local_glyph_rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ PremultipliedImage LocalGlyphRasterizer::drawGlyphBitmap(const std::string& font
jniFontFamily,
static_cast<jni::jboolean>(bold),
static_cast<jni::jchar>(glyphID));
jni::DeleteLocalRef(*env, jniFontFamily);

PremultipliedImage result = Bitmap::GetImage(*env, javaBitmap);
jni::DeleteLocalRef(*env, javaBitmap);
Expand Down

0 comments on commit 14423a2

Please sign in to comment.