Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions WordPress/Classes/Utility/ContainerContextFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class ContainerContextFactory: NSObject, ManagedObjectContextFactory {
completionBlock?()
}
}

/// Ensure that the `context`'s concurrency type is not `confinementConcurrencyType`, since it will crash if `perform` or `performAndWait` is called.
guard context.concurrencyType == .mainQueueConcurrencyType || context.concurrencyType == .privateQueueConcurrencyType else {
Copy link
Contributor Author

@dvdchr dvdchr Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do if context.concurrencyType == .confinementConcurrencyType {, but Xcode will throw out a warning if we type a deprecated enum value. 🙃

block()
return
}

if wait {
context.performAndWait(block)
} else {
Expand Down