mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-11-13 12:23:49 +01:00
prevent deadlock on when DataStack gets deallocated
This commit is contained in:
1 parent
0b24072259
commit
44cfbebedb
1 file changed
+9
-2
@@ -399,9 +399,16 @@ public final class DataStack {
|
||||
|
||||
deinit {
|
||||
|
||||
for store in self.coordinator.persistentStores {
|
||||
let coordinator = self.coordinator
|
||||
coordinator.performAsynchronously {
|
||||
|
||||
_ = try? self.coordinator.removePersistentStore(store)
|
||||
withExtendedLifetime(coordinator) { coordinator in
|
||||
|
||||
coordinator.persistentStores.forEach {
|
||||
|
||||
_ = try? coordinator.removePersistentStore($0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user