[Spice-devel] [PATCH spice-gtk 14/15] session: keep a reference on disconnect

Christophe Fergeau cfergeau at redhat.com
Wed Nov 26 07:18:16 PST 2014


On Tue, Nov 25, 2014 at 02:19:27PM +0100, Marc-André Lureau wrote:
> It is idiomatic for client code to clean up it's reference on channel

"its reference"

> disconnection. Keeping a reference during disconnect help solving

"helps"

> potential crashes if the session is unref during callbacks.

"unref'ed" or something like that

Looks good otherwise.

Christophe

> ---
>  gtk/spice-session.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index f0347db..e00e2b3 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -1740,6 +1740,7 @@ void spice_session_disconnect(SpiceSession *session)
>      if (s->disconnecting)
>          return;
>  
> +    g_object_ref(session);
>      s->disconnecting = TRUE;
>      s->cmain = NULL;
>  
> @@ -1757,6 +1758,7 @@ void spice_session_disconnect(SpiceSession *session)
>  
>      spice_session_abort_migration(session);
>      s->disconnecting = FALSE;
> +    g_object_unref(session);
>  }
>  
>  /**
> -- 
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141126/4a6a3133/attachment.sig>


More information about the Spice-devel mailing list