hw/char: clear dangling GLib event source tag
PATCH 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.
--- hw/char/virtio-console.c | 1 + 1 file changed, 1 insertion(+)
hw/char/virtio-console.c +1 -0
@@ -258,6 +258,7 @@ static void virtconsole_unrealize(DeviceState *dev)if (vcon->watch) {g_source_remove (vcon->watch); + vcon->watch =0 ; } }
Signature · 1 line
2.53.0
Hi
Quoted 15 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.
Signed-off-by Matthew Penney <[email protected]>--- hw/char/virtio-console.c | 1 + 1 file changed, 1 insertion(+)hw/char/virtio-console.c +0
-0
hw/char/virtio-console.c static void virtconsole_unrealize(DeviceState *dev) · line 261
Quoted 4 lines
hw/char/virtio-console.c +1
-0@@ -258,6 +258,7 @@ static void virtconsole_unrealize(DeviceState *dev)if (vcon->watch) {g_source_remove (vcon->watch); + vcon->watch =0 ;
The glib >= 2.56 way is:g_clear_handle_id(&vcon->watch, g_source_remove);
We could do a bulk change for the whole code base imho
anyway
Quoted 7 lines
hw/char/virtio-console.c +0
-1} } --2.53.0
Hi Marc-André,
Thanks for the swift reply!
Should I start by sending a V2 with your proposed update just for virtio-console.c, or do you prefer a larger bulk change across the codebase?
Best,
Matthew
Sent with Proton Mail secure email.
Quoted 40 lines · Marc-André Lureau
Hi
Quoted 15 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.
Signed-off-by Matthew Penney <[email protected]>--- hw/char/virtio-console.c | 1 + 1 file changed, 1 insertion(+)hw/char/virtio-console.c +0
-0hw/char/virtio-console.c static void virtconsole_unrealize(DeviceState *dev) · line 261
Quoted 4 lines
hw/char/virtio-console.c +1
-0@@ -258,6 +258,7 @@ static void virtconsole_unrealize(DeviceState *dev)if (vcon->watch) {g_source_remove (vcon->watch); + vcon->watch =0 ;The glib >= 2.56 way is:
g_clear_handle_id(&vcon->watch, g_source_remove);We could do a bulk change for the whole code base imho
anyway
Reviewed-by Marc-André Lureau <[email protected]>Quoted 7 lines
hw/char/virtio-console.c +0
-1} } --2.53.0
Hi
Quoted 6 lines · Matthew Penney
Hi Marc-André,
Thanks for the swift reply!
Should I start by sending a V2 with your proposed update just for
virtio-console.c, or do you prefer a larger bulk change across the codebase?
If you can clean the codebase in one patch, hopefully this is agreeable with all the subsystem maintainers.
Though if your patch is actually a fix, it's worth it to make it a different patch.
Quoted 51 lines
Best,
MatthewSent with Proton Mail secure email.
Quoted 40 lines · Marc-André Lureau
Hi
Quoted 15 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.
Signed-off-by Matthew Penney <[email protected]>--- hw/char/virtio-console.c | 1 + 1 file changed, 1 insertion(+)hw/char/virtio-console.c +0
-0hw/char/virtio-console.c static void virtconsole_unrealize(DeviceState *dev) · line 261
Quoted 4 lines
hw/char/virtio-console.c +1
-0@@ -258,6 +258,7 @@ static void virtconsole_unrealize(DeviceState *dev)if (vcon->watch) {g_source_remove (vcon->watch); + vcon->watch =0 ;The glib >= 2.56 way is:
g_clear_handle_id(&vcon->watch, g_source_remove);We could do a bulk change for the whole code base imho
anyway
Reviewed-by Marc-André Lureau <[email protected]>Quoted 7 lines
hw/char/virtio-console.c +0
-1} } --2.53.0
Signature · 1 line
Marc-André Lureau
Hi Marc-André,
Thanks for the suggestion.
I will send a v2 of this patch updating it to use g_clear_handle_id(), keeping the scope limited to the virtio-console fix.
I may submit a separate patch later for a broader conversion if the maintainers are in agreement.
Best,
Matthew
Sent with Proton Mail secure email.
Quoted 72 lines · Marc-André Lureau
Hi
Quoted 6 lines · Matthew Penney
Hi Marc-André,
Thanks for the swift reply!
Should I start by sending a V2 with your proposed update just for
virtio-console.c, or do you prefer a larger bulk change across the codebase?If you can clean the codebase in one patch, hopefully this is agreeable with all the subsystem maintainers.
Though if your patch is actually a fix, it's worth it to make it a different patch.
Quoted 51 lines
Best,
MatthewSent with Proton Mail secure email.
Quoted 40 lines · Marc-André Lureau
Hi
Quoted 15 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.
Signed-off-by Matthew Penney <[email protected]>--- hw/char/virtio-console.c | 1 + 1 file changed, 1 insertion(+)hw/char/virtio-console.c +0
-0hw/char/virtio-console.c static void virtconsole_unrealize(DeviceState *dev) · line 261
Quoted 4 lines
hw/char/virtio-console.c +1
-0@@ -258,6 +258,7 @@ static void virtconsole_unrealize(DeviceState *dev)if (vcon->watch) {g_source_remove (vcon->watch); + vcon->watch =0 ;The glib >= 2.56 way is:
g_clear_handle_id(&vcon->watch, g_source_remove);We could do a bulk change for the whole code base imho
anyway
Reviewed-by Marc-André Lureau <[email protected]>Quoted 7 lines
hw/char/virtio-console.c +0
-1} } --2.53.0
--
Marc-André Lureau