From ff8baba0b1e1dabf3ec2448775837a70d88c4cde Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Wed, 13 Sep 2023 14:40:51 +0200 Subject: [PATCH 1/2] Fix crash with mutated callback list --- .../main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt index cea552b9b..14fa40c60 100644 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt @@ -346,8 +346,9 @@ class LiteGoogleMapImpl(context: Context, var options: GoogleMapOptions) : Abstr ) map.setImageBitmap(it.bitmap) - for (callback in afterNextDrawCallback) callback() - afterNextDrawCallback.clear() + ArrayList(afterNextDrawCallback) + .also { afterNextDrawCallback.clear() } + .forEach { it() } if (cameraPositionChanged) { // Notify apps that new projection is now available -- GitLab From 632a83643ab611f012b88bf90e49cbdeae4e812d Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Wed, 13 Sep 2023 16:18:38 +0200 Subject: [PATCH 2/2] Fix lite mode map instance restoration crash This fixes a crash in the sample app --- .../main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt index 14fa40c60..65d84eb53 100644 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt @@ -210,7 +210,7 @@ class LiteGoogleMapImpl(context: Context, var options: GoogleMapOptions) : Abstr if (savedInstanceState?.containsKey(BUNDLE_CAMERA_POSITION) == true) { cameraPosition = savedInstanceState.getParcelable(BUNDLE_CAMERA_POSITION)!! - cameraBounds = savedInstanceState.getParcelable(BUNDLE_CAMERA_BOUNDS) + cameraBounds = (savedInstanceState.getParcelable(BUNDLE_CAMERA_BOUNDS) as LatLngBounds?)?.toMapbox() } postUpdateSnapshot() @@ -616,7 +616,7 @@ class LiteGoogleMapImpl(context: Context, var options: GoogleMapOptions) : Abstr override fun onSaveInstanceState(outState: Bundle) { outState.putParcelable(BUNDLE_CAMERA_POSITION, cameraPosition) - outState.putParcelable(BUNDLE_CAMERA_BOUNDS, cameraBounds) + outState.putParcelable(BUNDLE_CAMERA_BOUNDS, cameraBounds?.toGms()) } override fun setContentDescription(desc: String?) { -- GitLab