[Spice-devel] [PATCH spice-gtk 3/4] qmp: release channel on dispose

Marc-André Lureau marcandre.lureau at gmail.com
Thu Sep 27 12:12:14 UTC 2018


Hi

On Thu, Sep 27, 2018 at 3:22 PM Victor Toso <victortoso at redhat.com> wrote:
>
> On Wed, Sep 26, 2018 at 06:56:23PM +0400, marcandre.lureau at redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
> >
> > Do not leak the strong channel ref.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> >  src/qmp-port.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/src/qmp-port.c b/src/qmp-port.c
> > index bdc0c7e..89b27aa 100644
> > --- a/src/qmp-port.c
> > +++ b/src/qmp-port.c
> > @@ -203,6 +203,8 @@ static void spice_qmp_port_dispose(GObject *gobject)
> >      g_object_set_data(G_OBJECT(self->priv->channel),
> >                        "spice-qmp-port", NULL);
> >
> > +    g_clear_object(&self->priv->channel);
> > +
>
> Maybe remove the g_object_set_data above?

It should also remove the property, so you don't have a dangling
pointer, and you can recreate a qmp helper (for ex, on port reconnect)

thanks

>
> >      if (G_OBJECT_CLASS(spice_qmp_port_parent_class)->dispose)
> >          G_OBJECT_CLASS(spice_qmp_port_parent_class)->dispose(gobject);
> >  }
> > --
> > 2.19.0.271.gfe8321ec05
> >
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list