couchbaselabs/TouchDB-iOS — pull request #267 by mz2 (2013-06-22 15:00:13+00:00)
Title: Bug fix to #266 whereby TDRouter could get messaged after deallocation

Workaround (fix?) to https://github.com/couchbaselabs/TouchDB-iOS/issues/266 whereby TDRouter could get messaged after deallocation. Problem appears to be caused by a race condition whereby TDRouter's notification observer callback is started on one thread, and the router is deallocated on another (dealloc itself will send -stopNow to and thereby remove the notification observer, but this wasn't threadsafe).