From 6e856ebb675340d2935ca6bf3148fa94e4fdd19f Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 16 Jan 2019 16:22:01 +0100 Subject: [android] - avoid leaking compassView context through animator --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 5 +++++ .../src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'platform') diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 94f38bb2c0..9d8dbce289 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -411,6 +411,11 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { mapCallback.onDestroy(); initialRenderCallback.onDestroy(); + if (compassView != null) { + // avoid leaking context through animator #13742 + compassView.resetAnimation(); + } + if (mapboxMap != null) { mapboxMap.onDestroy(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java index 9c800c078f..6262418a29 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java @@ -68,7 +68,7 @@ public final class CompassView extends AppCompatImageView implements Runnable { this.isAnimating = isAnimating; } - private void resetAnimation() { + public void resetAnimation() { if (fadeAnimator != null) { fadeAnimator.cancel(); } -- cgit v1.2.1