-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[android] jni clean up - missing a couple DeleteLocalRef #11253
Conversation
@tobrun please look at the changes. I am not 100% sure about them - it was easier to do then discuss. |
return *conversion::convert<mbgl::Color, int>(env, polygon.Get(env, field)); | ||
auto jColor = polygon.Get(env, field); | ||
mbgl::Color color = *conversion::convert<mbgl::Color, int>(env, jColor); | ||
jni::DeleteLocalRef(env, jColor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jColor is of the type jint and these are just aliases for normal native value types, so there are no special lifetime or cleanup considerations.
@@ -34,6 +34,7 @@ mbgl::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env, jni::Obje | |||
static auto zoom = CameraPosition::javaClass.GetField<jni::jdouble>(env, "zoom"); | |||
|
|||
auto center = LatLng::getLatLng(env, position.Get(env, target)); | |||
jni::DeleteLocalRef(env, target); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great find!
auto name = jni::Make<std::string>(env, image.Get(env, nameField)); | ||
auto jName = image.Get(env, nameField); | ||
auto name = jni::Make<std::string>(env, jName); | ||
jni::DeleteLocalRef(env, jName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great find as well, do we need to delete the pixels local ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobrun Turns out that
jni::GetArrayRegion(env, *pixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get()));
does the release as per https://developer.android.com/training/articles/perf-jni.html
529b126
to
2f3fa19
Compare
2f3fa19
to
a11692f
Compare
No description provided.