summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Ulvinge <ulvinge@gmail.com>2015-07-19 01:10:34 +0200
committerNiklas Ulvinge <ulvinge@gmail.com>2015-07-19 01:10:34 +0200
commit13d86d4cbc49072c03a30a0f0571b77b020c70d6 (patch)
tree5630d6d39e6e1eed0d021cc10126a69cc6473a31
parent45311e98def801a8c47e5ec85e116c2d7d622e54 (diff)
downloadqtlocation-mapboxgl-13d86d4cbc49072c03a30a0f0571b77b020c70d6.tar.gz
Some memory management
-rw-r--r--android/cpp/jni.cpp5
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);