display(iOS): make QEMU errors non-fatal
This commit is contained in:
parent
8654fb3abc
commit
8c88fd9aa7
|
@ -1240,7 +1240,7 @@ class UTMRemoteData: UTMData {
|
|||
|
||||
func remoteVirtualMachineDidError(id: UUID, message: String) async {
|
||||
if let session = VMSessionState.allActiveSessions.values.first(where: { $0.vm.id == id }) {
|
||||
session.fatalError = message
|
||||
session.nonfatalError = message
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@ import SwiftUI
|
|||
|
||||
@Published var vmState: UTMVirtualMachineState = .stopped
|
||||
|
||||
@Published var fatalError: String?
|
||||
|
||||
@Published var nonfatalError: String?
|
||||
|
||||
@Published var primaryInput: CSInput?
|
||||
|
@ -159,7 +157,7 @@ extension VMSessionState: UTMVirtualMachineDelegate {
|
|||
|
||||
nonisolated func virtualMachine(_ vm: any UTMVirtualMachine, didErrorWithMessage message: String) {
|
||||
Task { @MainActor in
|
||||
fatalError = message
|
||||
nonfatalError = message
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,11 +163,6 @@ struct VMWindowView: View {
|
|||
state.alert = .nonfatalError(message)
|
||||
}
|
||||
}
|
||||
.onChange(of: session.fatalError) { newValue in
|
||||
if session.activeWindow == state.id, let message = newValue {
|
||||
state.alert = .fatalError(message)
|
||||
}
|
||||
}
|
||||
.onChange(of: session.vmState) { [oldValue = session.vmState] newValue in
|
||||
vmStateUpdated(from: oldValue, to: newValue)
|
||||
}
|
||||
|
@ -225,7 +220,7 @@ struct VMWindowView: View {
|
|||
state.isRunning = false
|
||||
}
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
|
||||
if session.vmState == .stopped && session.fatalError == nil {
|
||||
if session.vmState == .stopped {
|
||||
session.stop()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ import IOKit.pwr_mgt
|
|||
|
||||
@Published var vmState: UTMVirtualMachineState = .stopped
|
||||
|
||||
@Published var fatalError: String?
|
||||
|
||||
private var hasStarted: Bool = false
|
||||
private var preventIdleSleepAssertion: IOPMAssertionID?
|
||||
|
||||
|
@ -61,7 +59,6 @@ import IOKit.pwr_mgt
|
|||
|
||||
nonisolated func virtualMachine(_ vm: any UTMVirtualMachine, didErrorWithMessage message: String) {
|
||||
Task { @MainActor in
|
||||
fatalError = message
|
||||
NotificationCenter.default.post(name: .vmSessionError, object: nil, userInfo: ["Session": self, "Message": message])
|
||||
if !hasStarted {
|
||||
// if we got an error and haven't started, then cleanup
|
||||
|
|
Loading…
Reference in New Issue