Skip to content

Commit

Permalink
settings(apple): fix settings cancel running on wrong actor
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Dec 16, 2022
1 parent 3a79d06 commit f5c2cfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions Managers/UTMAppleVirtualMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,13 @@ import Virtualization

private var activeResourceUrls: [URL] = []

override func reloadConfiguration() throws {
@MainActor override func reloadConfiguration() throws {
let newConfig = try UTMAppleConfiguration.load(from: path) as! UTMAppleConfiguration
let oldConfig = appleConfig
config = UTMConfigurationWrapper(wrapping: newConfig)
Task { @MainActor in
updateConfigFromRegistry()
if #available(macOS 12, *) {
newConfig.system.boot.macRecoveryIpswURL = oldConfig.system.boot.macRecoveryIpswURL
}
updateConfigFromRegistry()
if #available(macOS 12, *) {
newConfig.system.boot.macRecoveryIpswURL = oldConfig.system.boot.macRecoveryIpswURL
}
}

Expand Down
4 changes: 2 additions & 2 deletions Platform/macOS/VMSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct VMSettingsView<Config: UTMConfiguration>: View {

func cancel() {
presentationMode.wrappedValue.dismiss()
data.busyWork {
try data.discardChanges(for: self.vm)
data.busyWorkAsync {
try await data.discardChanges(for: self.vm)
}
}
}
Expand Down

0 comments on commit f5c2cfd

Please sign in to comment.