Re: [PATCH virt-viewer] SessionSpice: Protect against unreffing window twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK.

Christophe

On Tue, Apr 14, 2015 at 03:28:49PM -0500, Jonathon Jongsma wrote:
> On Tue, 2015-04-14 at 14:40 -0500, Jonathon Jongsma wrote:
> > In theory, the dispose method can be called multiple times, so any
> > member variables that are unreffed should be set to NULL so that we
> > don't accidentally unref them multiple times.
> > ---
> >  src/virt-viewer-session-spice.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> > index da193ec..40197b0 100644
> > --- a/src/virt-viewer-session-spice.c
> > +++ b/src/virt-viewer-session-spice.c
> > @@ -146,7 +146,7 @@ virt_viewer_session_spice_dispose(GObject *obj)
> >      spice->priv->audio = NULL;
> >  
> >      if (spice->priv->main_window)
> > -        g_object_unref(spice->priv->main_window);
> > +        g_clear_object(&spice->priv->main_window);
> >  
> >      G_OBJECT_CLASS(virt_viewer_session_spice_parent_class)->dispose(obj);
> >  }
> 
> ... and clearly I can just remove the if() check as long as I'm using
> g_clear_object().
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Attachment: pgppJCUQfOJA1.pgp
Description: PGP signature

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux