From 45240eee52eb7eed443b8facad3b57d5d12c4743 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 16 Jan 2019 16:22:01 +0100 Subject: [PATCH] [android] - avoid leaking compassView context through animator --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 5 +++++ .../java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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 94f38bb2c0d..9d8dbce2893 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 void onDestroy() { 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 9c800c078fd..6262418a298 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 void isAnimating(boolean isAnimating) { this.isAnimating = isAnimating; } - private void resetAnimation() { + public void resetAnimation() { if (fadeAnimator != null) { fadeAnimator.cancel(); }