[android] clear the style object when the map is destroyed
This commit is contained in:
committed by
Łukasz Paczos
parent
d5868d3da8
commit
db275e5888
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user