summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2019-03-20 16:07:47 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2019-03-20 20:46:10 +0100
commitdb275e58888d10bfeb96529286d1d400fea504d5 (patch)
tree046693605fb8937eee7ddea9adbb3aebe1e0af6a /platform
parentd5868d3da822f2bf3297229bd879e76853108a63 (diff)
downloadqtlocation-mapboxgl-db275e58888d10bfeb96529286d1d400fea504d5.tar.gz
[android] clear the style object when the map is destroyed
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java5
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java7
2 files changed, 8 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
index f0155bda58..ebfac5a021 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
@@ -174,6 +174,9 @@ public final class MapboxMap {
*/
void onDestroy() {
locationComponent.onDestroy();
+ if (style != null) {
+ style.clear();
+ }
}
/**
@@ -813,7 +816,7 @@ public final class MapboxMap {
public void setStyle(Style.Builder builder, final Style.OnStyleLoaded callback) {
locationComponent.onStartLoadingMap();
if (style != null) {
- style.onWillStartLoadingMap();
+ style.clear();
}
if (callback != null) {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java
index f14e034816..ff93e2b099 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java
@@ -437,10 +437,11 @@ public class Style {
//
/**
- * Called when the underlying map will start loading a new style. This method will clean up this style
- * by setting the java sources and layers in a detached state and removing them from core.
+ * Called when the underlying map will start loading a new style or the map is destroyed.
+ * This method will clean up this style by setting the java sources and layers
+ * in a detached state and removing them from core.
*/
- void onWillStartLoadingMap() {
+ void clear() {
fullyLoaded = false;
for (Source source : sources.values()) {
if (source != null) {