Avoid having dandling pointer to a client.
Signed-off-by: Frediano Ziglio <[email protected]>
---
server/sound.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/server/sound.c b/server/sound.c
index 0c2a3ae..5ce028c 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -768,6 +768,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))
{
+ channel->connection = NULL;
+ }
+}
+
static uint8_t*
snd_channel_client_alloc_recv_buf(RedChannelClient *rcc, uint16_t type,
uint32_t size)
{
@@ -1410,6 +1418,7 @@ snd_channel_class_init(SndChannelClass *klass)
channel_class->config_socket = snd_channel_config_socket;
channel_class->alloc_recv_buf = snd_channel_client_alloc_recv_buf;
channel_class->release_recv_buf = snd_channel_client_release_recv_buf;
+ channel_class->on_disconnect = snd_channel_on_disconnect;
}
static void
--
2.7.4
_______________________________________________
Spice-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/spice-devel