diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2018-04-05 16:14:22 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2018-04-09 17:46:02 +0300 |
commit | 14423a225b2aa1d24cc7a889665358898fc3c66b (patch) | |
tree | eb0da554bceb053770f0a1e5cd894816c296f85c | |
parent | 1af1cbe721ecf7e3abaa6abc519ac357d8371d34 (diff) | |
download | qtlocation-mapboxgl-14423a225b2aa1d24cc7a889665358898fc3c66b.tar.gz |
[android] release local refs early
-rw-r--r-- | platform/android/src/image.cpp | 7 | ||||
-rw-r--r-- | platform/android/src/text/local_glyph_rasterizer.cpp | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/platform/android/src/image.cpp b/platform/android/src/image.cpp index 2a33944b18..0456381578 100644 --- a/platform/android/src/image.cpp +++ b/platform/android/src/image.cpp @@ -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 diff --git a/platform/android/src/text/local_glyph_rasterizer.cpp b/platform/android/src/text/local_glyph_rasterizer.cpp index ce1b0fc8fd..d232058d15 100644 --- a/platform/android/src/text/local_glyph_rasterizer.cpp +++ b/platform/android/src/text/local_glyph_rasterizer.cpp @@ -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); |