[Spice-devel] [PATCH v4 08/14] sound: Implement on_disconnect RedChannel callback

Christophe Fergeau cfergeau at redhat.com
Thu Dec 1 12:41:55 UTC 2016


On Wed, Nov 30, 2016 at 12:34:52PM +0000, Frediano Ziglio wrote:
> Avoid having dandling pointer to a client.

'dangling'

> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/sound.c |  9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/server/sound.c b/server/sound.c
> index a5b960b..00eab67 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -773,6 +773,14 @@ static int snd_channel_config_socket(RedChannelClient *rcc)
>      return TRUE;
>  }
>  
> +static void snd_channel_on_disconnect(RedChannelClient *rcc)
> +{
> +    SndChannel *channel = SND_CHANNEL(red_channel_client_get_channel(rcc));
> +    if (channel->connection && rcc == RED_CHANNEL_CLIENT(channel->connection)) {

Is it expected that channel->connection will sometimes not be equal to rcc here? Or
should it issue some kind of runtime warning if this happens?

> +        channel->connection = NULL;

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161201/6ede2b5d/attachment.sig>


More information about the Spice-devel mailing list