magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

MR_observeContextOnMainThread deadlocks the main thread #1123

Closed pronebird closed 8 years ago

pronebird commented 8 years ago

If you set up a main queue context, change objects in it and save it, you get the app deadlocked.

NSManagedObjectContext *rootContext = [NSManagedObjectContext MR_rootSavingContext];
self.context = [NSManagedObjectContext MR_newMainQueueContext];
[self.context setParentContext:rootContext];
[self.context MR_observeContextOnMainThread:rootContext];
  1. Root context does not rely on MR_observeContextOnMainThread implementation at all.
  2. Root context uses dispatch_async to merge changes to default context, while MR_observeContextOnMainThread uses performSelectorOnMainThread with waitUntilDone = YES.
tonyarnold commented 8 years ago

This is bullshit

Thanks!