diff options
author | Niklas Ulvinge <ulvinge@gmail.com> | 2015-07-19 01:10:34 +0200 |
---|---|---|
committer | Niklas Ulvinge <ulvinge@gmail.com> | 2015-07-19 01:10:34 +0200 |
commit | 13d86d4cbc49072c03a30a0f0571b77b020c70d6 (patch) | |
tree | 5630d6d39e6e1eed0d021cc10126a69cc6473a31 /android | |
parent | 45311e98def801a8c47e5ec85e116c2d7d622e54 (diff) | |
download | qtlocation-mapboxgl-13d86d4cbc49072c03a30a0f0571b77b020c70d6.tar.gz |
Some memory management
Diffstat (limited to 'android')
-rw-r--r-- | android/cpp/jni.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index dd75caa214..46a73ef3f7 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -227,7 +227,9 @@ mbgl::AnnotationSegment annotation_segment_from_latlng_jlist(JNIEnv *env, jobjec } segment.push_back(mbgl::LatLng(latitude, longitude)); + env->DeleteLocalRef(latLng); } + env->DeleteLocalRef(array); return segment; } @@ -662,6 +664,7 @@ std::pair<mbgl::AnnotationSegment, mbgl::StyleProperties> readPolygon(JNIEnv *en jobject points = env->GetObjectField(polygon, polygonPointsId); mbgl::AnnotationSegment segment = annotation_segment_from_latlng_jlist(env, points); + env->DeleteLocalRef(points); return std::make_pair(segment, shapeProperties); } @@ -727,6 +730,8 @@ jlongArray JNICALL nativeAddPolygons(JNIEnv *env, jobject obj, jlong nativeMapVi } shapes.emplace_back(mbgl::AnnotationSegments {{ segment.first }}, segment.second); + + env->DeleteLocalRef(polygon); } std::vector<uint32_t> shapeAnnotationIDs = nativeMapView->getMap().addShapeAnnotations(shapes); |