From adb43bffbb458eae0c6f5f9035b3caeb95b2808f Mon Sep 17 00:00:00 2001 From: osy <50960678+osy@users.noreply.github.com> Date: Tue, 22 Sep 2026 14:02:01 -0500 Subject: [PATCH] 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 --- Scripting/UTMScriptingConfigImpl.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Scripting/UTMScriptingConfigImpl.swift b/Scripting/UTMScriptingConfigImpl.swift index 4848e810..59417b64 100644 --- a/Scripting/UTMScriptingConfigImpl.swift +++ b/Scripting/UTMScriptingConfigImpl.swift @@ -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)