diff options
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:35 +0100 |
commit | 94be5e1c10f8e4e4e1fba78d97d391582097376f (patch) | |
tree | d889abfe35f8377a8d2fcdabec08dce8306af6a7 | |
parent | 174c8fa7e4927ebf28a3d0e07c995d3e3d69de76 (diff) | |
download | qtlocation-mapboxgl-94be5e1c10f8e4e4e1fba78d97d391582097376f.tar.gz |
[android] clear the style object when the map is destroyedupstream/nb-liquid-earliest
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 5 | ||||
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java | 7 |
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) { |