-
-
Notifications
You must be signed in to change notification settings - Fork 9
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when changing styles quickly by wrapping styles in SafeStyle #269
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c00d56f
to
11ed21c
Compare
Co-authored-by: michalgwo <[email protected]>
11ed21c
to
d325dae
Compare
It fixes the crashes mentioned in #252 when loading an empty map, but when there is some data with the anchor, for example: val amtrakStations = rememberGeoJsonSource(id = "amtrak-stations", data = FeatureCollection())
Anchor.Below("background") {
SymbolLayer(id = "amtrak-stations", source = amtrakStations)
} There is another crash:
This validation in To replicate this I'm using Style Switcher Demo with LaunchedEffect(selectedIndex) {
if (selectedIndex == 1) {
selectedIndex = 2
}
} Then I click on Liberty style. When I'm testing on my Xiaomi Redmi Note 7 it crashes every time, but on Emulator for some reason, I need to click multiple times to crash. |
I found out that in some cases it also crashes on recreate, gonna investigate futher. |
The crash happens on recreate (for example screen rotation) when there are layers added by the user. Steps to reproduce on the demo app:
As for the solution, I think it's safe to unload the style in onDestroy, style will be recreated in onCreate anyway. |
Attempt to fix #252 with an alternative approach to #265.