magicalpanda / MagicalRecord

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

Fixed concurrency issue in WorkingName property #1159

Closed tristanseifert closed 8 years ago

tristanseifert commented 8 years ago

When debugging an application with different contexts, using the -com.apple.CoreData.ConcurrencyDebug 1 argument to spot CoreData concurrency problems, the debugger sometimes breaks into MR_workingName due to a CoreData concurrency error.

This fix ensures that the properties are accessed only on the queue that is used by the context.

tonyarnold commented 8 years ago

The only issue I can see with this patch, is that if the context is NSMainQueueConcurrencyType, and we're executing this method on the main thread, it could potentially deadlock. Let me have a quick play and see if I can come up with a workaround.

tonyarnold commented 8 years ago

OK, I've addressed this in 8069330e6fdf7719cf9b998ef3508f0694a314b4. Thanks for the PR.