mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-12 02:24:01 +00:00
scripting: close the VM's window when updating its configuration
A VM's window is kept after it stops and run(vm:) reuses it as is. The Edit button closes it before opening the settings, but AppleScript's update configuration did not. If the displays were removed that way, the next start got the old display window, which looks up the now missing display 0 and crashes with an index out of range. Close the window before updating the configuration, like the Edit button does, so the next start creates the right kind of window. Resolves #7882 Assisted-by: Claude:claude-opus-5-5
This commit is contained in:
@@ -34,6 +34,7 @@ import Foundation
|
||||
guard vm.state == .stopped else {
|
||||
throw ScriptingError.notStopped
|
||||
}
|
||||
data.close(vm: box) // close window
|
||||
let wrapper = UTMScriptingConfigImpl(vm.config)
|
||||
try wrapper.updateConfiguration(from: newConfiguration)
|
||||
try await data.save(vm: box)
|
||||
|
||||
Reference in New Issue
Block a user