Crash on macOS when screen resolution changes when using SDL UI frontend Description of problem: In the above configuration, booting NetBSD works fine up to the point where the kernel sets the framebuffer resolution for the console, which results in a window size change. At this point, the OS terminates the qemu process with this error message: ``` *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow geometry should only be modified on the main thread!' *** First throw call stack: ( 0 CoreFoundation 0x00000001849208c0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000184419eb4 objc_exception_throw + 60 2 CoreFoundation 0x0000000184945bac _CFBundleGetValueForInfoKey + 0 3 AppKit 0x00000001880a6ab8 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 240 4 AppKit 0x00000001880b2a38 -[NSThemeFrame _tileTitlebarAndRedisplay:] + 88 5 AppKit 0x00000001880c18a0 -[NSTitledFrame _titleDidChange] + 116 6 AppKit 0x0000000188a92f04 -[NSTitledFrame setTitle:subtitle:] + 420 7 AppKit 0x00000001880c1570 -[NSThemeFrame setTitle:] + 52 8 AppKit 0x000000018866e0fc -[NSFrameView _updateTitleProperties:animated:] + 44 9 AppKit 0x0000000188a85e98 -[NSThemeFrame _updateTitleProperties:animated:] + 156 10 CoreFoundation 0x00000001848a0780 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 11 CoreFoundation 0x00000001849349a8 ___CFXRegistrationPost_block_invoke + 88 12 CoreFoundation 0x00000001849348f0 _CFXRegistrationPost + 440 13 CoreFoundation 0x000000018486f434 _CFXNotificationPost + 764 14 Foundation 0x0000000185960c74 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 15 AppKit 0x000000018881da88 -[NSWindowTitleController _propertiesChanged:] + 128 16 AppKit 0x00000001880c1388 -[NSWindow _dosetTitle:andDefeatWrap:] + 156 17 libSDL2-2.0.0.dylib 0x0000000106aa9abc Cocoa_SetWindowTitle + 104 18 qemu-system-aarch64 0x0000000105006628 sdl_update_caption + 256 19 qemu-system-aarch64 0x0000000105007838 sdl_mouse_mode_change + 168 20 qemu-system-aarch64 0x00000001054ab100 notifier_list_notify + 36 21 qemu-system-aarch64 0x0000000104d28124 qemu_input_check_mode_change + 96 22 qemu-system-aarch64 0x0000000104e13a74 hid_pointer_activate + 32 23 qemu-system-aarch64 0x0000000104f44c2c usb_process_one + 464 24 qemu-system-aarch64 0x0000000104f4491c usb_handle_packet + 120 25 qemu-system-aarch64 0x0000000104f58a94 xhci_kick_epctx + 1888 26 qemu-system-aarch64 0x00000001052d8f78 memory_region_write_accessor + 264 27 qemu-system-aarch64 0x00000001052d8db8 access_with_adjusted_size + 348 28 qemu-system-aarch64 0x00000001052d8c04 memory_region_dispatch_write + 428 29 qemu-system-aarch64 0x00000001052e6cfc flatview_write_continue + 344 30 qemu-system-aarch64 0x00000001052e4068 flatview_write + 156 31 qemu-system-aarch64 0x00000001052e9424 subpage_write + 124 32 qemu-system-aarch64 0x00000001052d8db8 access_with_adjusted_size + 348 33 qemu-system-aarch64 0x00000001052d8c04 memory_region_dispatch_write + 428 34 qemu-system-aarch64 0x000000010532ebf4 io_writex + 184 35 qemu-system-aarch64 0x000000010532ed44 do_st_mmio_leN + 104 36 qemu-system-aarch64 0x0000000105323e78 do_st4_mmu + 536 37 ??? 0x0000000108a91750 0x0 + 4440266576 38 qemu-system-aarch64 0x00000001053108f0 cpu_tb_exec + 164 39 qemu-system-aarch64 0x0000000105311754 cpu_exec_loop + 1084 40 qemu-system-aarch64 0x0000000105310edc cpu_exec_setjmp + 48 41 qemu-system-aarch64 0x0000000105310dcc cpu_exec + 560 42 qemu-system-aarch64 0x0000000105332650 tcg_cpus_exec + 44 43 qemu-system-aarch64 0x0000000105332c1c mttcg_cpu_thread_fn + 240 44 qemu-system-aarch64 0x00000001054a7494 qemu_thread_start + 128 45 libsystem_pthread.dylib 0x00000001847cf034 _pthread_start + 136 46 libsystem_pthread.dylib 0x00000001847c9e3c thread_start + 8 ) libc++abi: terminating due to uncaught exception of type NSException ``` I think there have been other bugs of a similar nature in the past with the Cocoa UI. The regression may be because of stricter checks in the new macOS version. Steps to reproduce: 1. Start qemu (the QEMU_EFI.fd is from Tianocore EDK2). 2. Wait for the NetBSD kernel to set framebuffer resolution and observe the crash. With `-nographic`, the problem does not occur.