Commit 23ffb0abfa for qemu.org

commit 23ffb0abfadaf87744da091be4cf2abad9ce07e6
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Tue Jun 23 11:44:39 2026 +0400

    ui/console: fire console ADDED/REMOVED notifications

    Fire CONSOLE_ADDED at the end of graphic_console_init() and
    CONSOLE_REMOVED at the start of graphic_console_close(), so display
    backends can react to console hotplug/unplug events.

    REMOVED fires before the device link is cleared and before the
    placeholder surface swap, so handlers can unregister their DCL while
    the console is still in a known state.

    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-24-4656aec3398d@redhat.com>

diff --git a/ui/console.c b/ui/console.c
index 76851bc129..975eaf1570 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1142,6 +1142,7 @@ QemuConsole *qemu_graphic_console_create(DeviceState *dev, uint32_t head,

     surface = qemu_create_placeholder_surface(width, height, noinit);
     qemu_console_set_surface(s, surface);
+    qemu_console_notify(QEMU_CONSOLE_ADDED, s);
     return s;
 }

@@ -1158,6 +1159,7 @@ void qemu_graphic_console_close(QemuConsole *con)
     int height = qemu_console_get_height(con, 480);

     trace_console_gfx_close(con->index);
+    qemu_console_notify(QEMU_CONSOLE_REMOVED, con);
     object_property_set_link(OBJECT(con), "device", NULL, &error_abort);
     qemu_graphic_console_set_hwops(con, &unused_ops, NULL);
     timer_del(con->ui_timer);