applidium / ADClusterMapView

MKMapView with clustering
http://applidium.github.io/ADClusterMapView/
Other
658 stars 129 forks source link

SetAnnotations crashes if called multiple times quickly #22

Closed nicked closed 11 years ago

nicked commented 11 years ago

If you call setAnnotations:, the map view recalculates all it's clusters on a background queue.

However, if you call setAnnotations: again while clusters are still being calculated, there is a high probability of the app crashing. You can test this by calling it rapidly in succession (say, in a loop).

A semaphore or some flag should be used to prevent it recalculating clusters while it's already doing so.

Cheers, Nick

ps. Thanks for the code, it's the best clustering component I've found so far!

PatrickNLT commented 11 years ago

Hi, thanks for the feedback, we will have a look at this issue soon!

nicked commented 11 years ago

Thanks.

Also probably related: if you set the map's region while the clustering is happening in the background, there's also a high probability of a crash. Seems that MKMapView fiddles with the annotations when you change the region and this upsets things.

PatrickNLT commented 11 years ago

Thanks. Do you have any kind of logs related to this issue?

PatrickNLT commented 11 years ago

I fixed the first problem. If you still encounter problems when setting the map's region, please open a new issue, thanks!

nicked commented 11 years ago

Thanks Patrick. I've since put in a few workarounds to avoid crashes, and now after reverting some of them, I can't reproduce that crash :)

If I see any problems in future I'll attach a crash dump.

Cheers, Nick