mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-14 21:23:43 +01:00
prevent deadlock on when DataStack gets deallocated
This commit is contained in:
@@ -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