Skip to content

Commit 3f25328

Browse files
committed
fix(android): stabilize lifecycle handling for MapView detachment
1 parent 788874f commit 3f25328

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,9 @@ class GoogleMapsViewImpl(
867867
}
868868

869869
override fun onDetachedFromWindow() {
870-
super.onDetachedFromWindow()
871870
lifecycleObserver?.let { lifecycle?.removeObserver(it) }
872871
lifecycle = null
873-
lifecycleObserver?.toCreatedState()
872+
super.onDetachedFromWindow()
874873
}
875874

876875
override fun onMarkerClick(marker: Marker): Boolean {

android/src/main/java/com/rngooglemapsplus/MapLifecycleEventObserver.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class MapLifecycleEventObserver(
3535
}
3636

3737
private fun toState(state: Lifecycle.State) {
38+
if (currentState == Lifecycle.State.DESTROYED) return
3839
while (currentState != state) {
3940
when {
4041
currentState < state -> upFromCurrentState()

0 commit comments

Comments
 (0)