Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Deliver OnMapReady only when the map is fully initialized #13207

Closed
LukasPaczos opened this issue Oct 26, 2018 · 0 comments
Closed

Deliver OnMapReady only when the map is fully initialized #13207

LukasPaczos opened this issue Oct 26, 2018 · 0 comments
Labels
Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release

Comments

@LukasPaczos
Copy link
Contributor

Race condition patched up in the #13203 introduced/exposed another bug - instead of marking map as initialized when MapboxMap object is created, we should do that at the end of the initialization block, to not deliver the onMapReady prematurely.

This can lead to crashes like

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mapbox.mapboxsdk.maps.MapGestureDetector.addOnMapClickListener(com.mapbox.mapboxsdk.maps.MapboxMap$OnMapClickListener)' on a null object reference
    at com.mapbox.mapboxsdk.maps.MapView$GesturesManagerInteractionListener.onAddMapClickListener(MapView.java:1420)
    at com.mapbox.mapboxsdk.maps.MapboxMap.addOnMapClickListener(MapboxMap.java:2133)
    at com.mapbox.mapboxsdk.testapp.activity.maplayout.DoubleMapActivity$DoubleMapFragment.lambda$onViewCreated$1$DoubleMapActivity$DoubleMapFragment(DoubleMapActivity.java:100)
    at com.mapbox.mapboxsdk.testapp.activity.maplayout.DoubleMapActivity$DoubleMapFragment$$Lambda$0.onMapReady(Unknown Source:2)
    at com.mapbox.mapboxsdk.maps.MapView$MapCallback.onMapReady(MapView.java:1602)
    at com.mapbox.mapboxsdk.maps.MapView$MapCallback.initialise(MapView.java:1591)
    at com.mapbox.mapboxsdk.maps.MapView.initialiseMap(MapView.java:181)
    at com.mapbox.mapboxsdk.maps.MapView.access$800(MapView.java:76)
    at com.mapbox.mapboxsdk.maps.MapView$6.run(MapView.java:336)
@LukasPaczos LukasPaczos added Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release labels Oct 26, 2018
@LukasPaczos LukasPaczos added this to the android-v6.7.0 milestone Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release
Projects
None yet
Development

No branches or pull requests

1 participant