ui/cocoa: implement display cleanup

Move cbowner release from QemuCocoaAppController -dealloc to
cocoa_display_cleanup(), since cbowner is allocated in
cocoa_display_init() and cleanup is the symmetric teardown path.

Tested-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-20-4656aec3398d@redhat.com>
This commit is contained in:
Marc-André Lureau
2026-06-23 11:44:35 +04:00
parent a3cf9b55bb
commit 48b29d9eaa

View File

@@ -1206,8 +1206,6 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
COCOA_DEBUG("QemuCocoaAppController: dealloc\n");
[cocoaView release];
[cbowner release];
cbowner = nil;
[super dealloc];
}
@@ -2038,9 +2036,26 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
qemu_main = cocoa_main;
}
static void cocoa_display_cleanup(void)
{
if (!kbd) {
return;
}
qemu_console_unregister_listener(&dcl);
g_clear_pointer(&kbd, qkbd_state_free);
qemu_remove_mouse_mode_change_notifier(&mouse_mode_change_notifier);
qemu_clipboard_peer_unregister(&cbpeer);
g_clear_pointer(&cbinfo, qemu_clipboard_info_unref);
qemu_event_destroy(&cbevent);
[cbowner release];
cbowner = nil;
}
static QemuDisplay qemu_display_cocoa = {
.type = DISPLAY_TYPE_COCOA,
.init = cocoa_display_init,
.cleanup = cocoa_display_cleanup,
};
static void register_cocoa(void)