amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 346 forks source link

Check that marker is on map before setting the icon #662

Closed PaulWagener closed 4 years ago

PaulWagener commented 4 years ago

There is a race condition in the case the following situation happens:

  1. User updates the icon of a Pin with a BitmapDescriptorFactory.FromView()
  2. Immediately after remove the Pin from the map

This results in this library calling SetIcon() on the native marker AFTER it has been removed from the native map. This results in Google Maps throwing a Java.Lang.IllegalArgumentException: Unmanaged descriptor exception.

By checking that the marker hasn't been removed before calling SetIcon() we can prevent this exception.

PaulWagener commented 4 years ago

Fixes #657

amay077 commented 4 years ago

Thanks for your contribute!