route-me/route-me — pull request #178 by danielgard (2012-05-11 12:34:14+00:00)
Title: tile loading improvement - fixes crashs when deallocating owning vc while tiles are loading 

Fixed bug:
When scrolling the map fast and the map view is deallocated (e.g. UINavigationViewController pops the owner VC), still loading tiles forces a crash.

Technical bug description:
When dispatching from loading thread to main thread after image load, the dispatches are sued when main run loop is busy. While this time, the RMWebTileImage is deallocated... the call gets dispatched into a deallocated object.

How it is fixed:
It's fixed by changing the RMURLConnectionOperation from non-concurrent to concurrent behavior and schedule the NSURLConnection into MainRunloop instead of running a new thread.
The NSURLConnection delegate is now called on the main thread. Dispatch to main thread is no longer needed.
It still works asynchronously and perhaps a bit faster ;)