public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH] hw/char: clear dangling GLib event source tag
@ 2026-03-05  0:30 Matthew Penney
  2026-03-05 10:22 ` Marc-André Lureau
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Penney @ 2026-03-05  0:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Matthew Penney, Michael S. Tsirkin, lvivier, amit,
	marcandre.lureau, Paolo Bonzini

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>
---
 hw/char/virtio-console.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 25db0f019b..11bf51e3ea 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -258,6 +258,7 @@ static void virtconsole_unrealize(DeviceState *dev)
 
     if (vcon->watch) {
         g_source_remove(vcon->watch);
+        vcon->watch = 0;
     }
 }
 
-- 
2.53.0




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/char: clear dangling GLib event source tag
  2026-03-05  0:30 [PATCH] hw/char: clear dangling GLib event source tag Matthew Penney
@ 2026-03-05 10:22 ` Marc-André Lureau
  2026-03-05 13:20   ` Matthew Penney
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2026-03-05 10:22 UTC (permalink / raw)
  To: Matthew Penney
  Cc: qemu-devel, Michael S. Tsirkin, lvivier, amit, Paolo Bonzini

Hi

On Thu, Mar 5, 2026 at 1:40 AM Matthew Penney <matt@matthewpenney.net> wrote:
>
> 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>
> ---
>  hw/char/virtio-console.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
> index 25db0f019b..11bf51e3ea 100644
> --- a/hw/char/virtio-console.c
> +++ b/hw/char/virtio-console.c
> @@ -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 <marcandre.lureau@redhat.com>

>      }
>  }
>
> --
> 2.53.0
>
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/char: clear dangling GLib event source tag
  2026-03-05 10:22 ` Marc-André Lureau
@ 2026-03-05 13:20   ` Matthew Penney
  2026-03-05 13:25     ` Marc-André Lureau
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Penney @ 2026-03-05 13:20 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: qemu-devel, Michael S. Tsirkin, lvivier, amit, Paolo Bonzini

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.

On Thursday, 5 March 2026 at 10:23, Marc-André Lureau <marcandre.lureau@redhat.com> wrote:

> Hi
> 
> On Thu, Mar 5, 2026 at 1:40 AM Matthew Penney <matt@matthewpenney.net> wrote:
> >
> > 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>
> > ---
> >  hw/char/virtio-console.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
> > index 25db0f019b..11bf51e3ea 100644
> > --- a/hw/char/virtio-console.c
> > +++ b/hw/char/virtio-console.c
> > @@ -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 <marcandre.lureau@redhat.com>
> 
> >      }
> >  }
> >
> > --
> > 2.53.0
> >
> >
> 
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/char: clear dangling GLib event source tag
  2026-03-05 13:20   ` Matthew Penney
@ 2026-03-05 13:25     ` Marc-André Lureau
  2026-03-05 15:31       ` Matthew Penney
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2026-03-05 13:25 UTC (permalink / raw)
  To: Matthew Penney
  Cc: qemu-devel, Michael S. Tsirkin, lvivier, amit, Paolo Bonzini

Hi

On Thu, Mar 5, 2026 at 2:22 PM Matthew Penney <matt@matthewpenney.net> wrote:
>
> 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.

>
> Best,
> Matthew
>
>
>
> Sent with Proton Mail secure email.
>
> On Thursday, 5 March 2026 at 10:23, Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
>
> > Hi
> >
> > On Thu, Mar 5, 2026 at 1:40 AM Matthew Penney <matt@matthewpenney.net> wrote:
> > >
> > > 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>
> > > ---
> > >  hw/char/virtio-console.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
> > > index 25db0f019b..11bf51e3ea 100644
> > > --- a/hw/char/virtio-console.c
> > > +++ b/hw/char/virtio-console.c
> > > @@ -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 <marcandre.lureau@redhat.com>
> >
> > >      }
> > >  }
> > >
> > > --
> > > 2.53.0
> > >
> > >
> >
> >
>


-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/char: clear dangling GLib event source tag
  2026-03-05 13:25     ` Marc-André Lureau
@ 2026-03-05 15:31       ` Matthew Penney
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Penney @ 2026-03-05 15:31 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: qemu-devel, Michael S. Tsirkin, lvivier, amit, Paolo Bonzini

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.

On Thursday, 5 March 2026 at 13:25, Marc-André Lureau <marcandre.lureau@gmail.com> wrote:

> Hi
> 
> On Thu, Mar 5, 2026 at 2:22 PM Matthew Penney <matt@matthewpenney.net> wrote:
> >
> > 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.
> 
> >
> > Best,
> > Matthew
> >
> >
> >
> > Sent with Proton Mail secure email.
> >
> > On Thursday, 5 March 2026 at 10:23, Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> >
> > > Hi
> > >
> > > On Thu, Mar 5, 2026 at 1:40 AM Matthew Penney <matt@matthewpenney.net> wrote:
> > > >
> > > > 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>
> > > > ---
> > > >  hw/char/virtio-console.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
> > > > index 25db0f019b..11bf51e3ea 100644
> > > > --- a/hw/char/virtio-console.c
> > > > +++ b/hw/char/virtio-console.c
> > > > @@ -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 <marcandre.lureau@redhat.com>
> > >
> > > >      }
> > > >  }
> > > >
> > > > --
> > > > 2.53.0
> > > >
> > > >
> > >
> > >
> >
> 
> 
> --
> Marc-André Lureau
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-05 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05  0:30 [PATCH] hw/char: clear dangling GLib event source tag Matthew Penney
2026-03-05 10:22 ` Marc-André Lureau
2026-03-05 13:20   ` Matthew Penney
2026-03-05 13:25     ` Marc-André Lureau
2026-03-05 15:31       ` Matthew Penney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox