Skip to contentSkip to conversation

hw/char: clear dangling GLib event source tag

PATCH In review Matthew Penney 2 participants 3 messages Mar 5 – Mar 24

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/char: 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.

v2:
Use g_clear_handle_id() per advice from Marc-André Lureau

---
 hw/char/virtio-console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/virtio-console.c +1 -1
index 25db0f019b..efe7cd6772 100644
@@ -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);
     }
 }
 
Signature · 1 line
2.53.0
#1 lore raw

Hi,

Just a gentle ping regarding the v2 patch I sent a couple of weeks ago.
Patchew: https://patchew.org/QEMU/[email protected]/

Thanks for your time.

Best regards,
Matthew Penney

Sent with Proton Mail secure email.

Quoted 30 lines · Matthew Penney

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.

v2:
Use g_clear_handle_id() per advice from Marc-André Lureau

---
 hw/char/virtio-console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/virtio-console.c +1 -1
index 25db0f019b..efe7cd6772 100644
@@ -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);
     }
 }
 
Signature · 1 line
2.53.0
#2 lore raw
In reply to Matthew Penney
Quoted 4 lines · Matthew Penney

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.

Quoted 8 lines

v2:
Use g_clear_handle_id() per advice from Marc-André Lureau

---
  hw/char/virtio-console.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Merged as commit 34aad589019c8687fb3b19ba79d64d97071a7205, thanks.