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