On Mon, Jan 16, 2012 at 11:13:37AM +0100, Marc-André Lureau wrote:
> On Mon, Jan 16, 2012 at 10:58 AM, Christophe Fergeau
> <cferg...@redhat.com> wrote:
> > spice_audio_new can return a NULL pointer when there's a failure
> > during the initialization of the audio system. When this happens,
> > we shouldn't keep initializing the spice audio channel as if nothing
> > happened, but just stop the connection.
> > This can be tested by forcing the "self" variable to NULL in
> > spice_audio_new
> > ---
> >  gtk/spice-audio.c |    8 +++++---
> >  1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
> > index f58a81e..9eddf0c 100644
> > --- a/gtk/spice-audio.c
> > +++ b/gtk/spice-audio.c
> > @@ -222,9 +222,11 @@ SpiceAudio *spice_audio_new(SpiceSession *session, 
> > GMainContext *context,
> >     self = SPICE_AUDIO(spice_gstaudio_new(session, context, name));
> >  #endif
> >
> > -    spice_g_signal_connect_object(session, "notify::enable-audio", 
> > G_CALLBACK(session_enable_audio), self, 0);
> > -    spice_g_signal_connect_object(session, "channel-new", 
> > G_CALLBACK(channel_new), self, 0);
> > -    update_audio_channels(self, session);
> 
> I would prefer to just return here:
> 
> if (!self)
>     return NULL;

Pushed with these changes

Christophe

Attachment: pgpEhwWhGRl54.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to