mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-17 23:14:05 +01:00
prevent deadlock on when DataStack gets deallocated
This commit is contained in:
@@ -399,9 +399,16 @@ public final class DataStack {
|
|||||||
|
|
||||||
deinit {
|
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