Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Separate MapView disposal from LifecycleOwner changes #228

Merged
merged 1 commit into from Nov 30, 2022

Conversation

DSteve595
Copy link
Contributor

@DSteve595 DSteve595 commented Nov 22, 2022

#206 introduced a crash when disposing the MapView, as reported in #207. Since the DisposableEffect has multiple keys, changes to any of them will result in the MapView becoming destroyed, which is not necessarily what we want. This repro project (extremely helpful, thank you @thekingrenz23!) revealed a case where the lifecycle owner (one of the DisposableEffect keys) can change without changing the MapView or context. This puts the MapView into a bad state, where it's "destroyed" but still shown and fully interactible.
This moves the MapView disposal into its own DisposableEffect with only the MapView as a key, avoiding the unwanted disposal.

Fixes #207 馃

@DSteve595 DSteve595 changed the title Separate MapView disposal from LifecycleOwner changes fix: Separate MapView disposal from LifecycleOwner changes Nov 22, 2022
@basurahan
Copy link

Will this be merged? I need this fix

Copy link
Member

@arriolac arriolac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@DSteve595 DSteve595 merged commit 0618bde into googlemaps:main Nov 30, 2022
@DSteve595 DSteve595 deleted the lifecycle-destroy-crash branch November 30, 2022 20:26
@polivmi1
Copy link
Contributor

polivmi1 commented Dec 1, 2022

@DSteve595 great find. Thank you!

@DSteve595
Copy link
Contributor Author

@thekingrenz23 A release will be made shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App crashes on bottom nav due to a fix on version 2.7.2 mapView.onDestroy(), mapView.removeAllViews()
5 participants