Sfoglia il codice sorgente

display(iOS): make QEMU errors non-fatal

osy 1 anno fa
parent
commit
8c88fd9aa7

+ 1 - 1
Platform/UTMData.swift

@@ -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
         }
     }
 

+ 1 - 3
Platform/iOS/VMSessionState.swift

@@ -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
         }
     }
     

+ 1 - 6
Platform/iOS/VMWindowView.swift

@@ -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()
                 }
             }

+ 0 - 3
Platform/macOS/VMHeadlessSessionState.swift

@@ -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