Commit 34aad58901 for qemu.org
commit 34aad589019c8687fb3b19ba79d64d97071a7205
Author: Matthew Penney <matt@matthewpenney.net>
Date: Thu Mar 5 21:33:32 2026 +0000
hw/char/virtio-console: clear dangling GLib event source tag
Clear dangling GLib event source tag when virtio-console is
unrealized. This prevents a stale tag from being used, and
maintains consistency with the rest of virtio-console.
Signed-off-by: Matthew Penney <matt@matthewpenney.net>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260305213308.96441-1-matt@matthewpenney.net>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 25db0f019b..efe7cd6772 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -257,7 +257,7 @@ static void virtconsole_unrealize(DeviceState *dev)
VirtConsole *vcon = VIRTIO_CONSOLE(dev);
if (vcon->watch) {
- g_source_remove(vcon->watch);
+ g_clear_handle_id(&vcon->watch, g_source_remove);
}
}