[Spice-devel] [PATCH spice 3/5] red_channel: Remove channel core to remove the stream watch on disconnect
Hans de Goede
hdegoede at redhat.com
Sat Mar 10 11:31:27 PST 2012
We allow channels to have different core implementations, but we were
relying on reds_stream_free to remove the stream watch on disconnect,
and reds_stream_free always uses the qemu core implementation.
So far we were getting away with this since all the alternative core
implementations always return NULL from watch_add.
But:
1) The code before this patch clearly was not correct, since it was matching
a channel-core watch_add with a qemu-core watch_remove
2) I plan to move red_worker over to actually using an alternative watch
implementation at which point this becomes a real problem
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
server/red_channel.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/server/red_channel.c b/server/red_channel.c
index 13cc525..5f906e6 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -1194,6 +1194,10 @@ void red_channel_client_disconnect(RedChannelClient *rcc)
if (rcc->channel->channel_cbs.pre_disconnect) {
rcc->channel->channel_cbs.pre_disconnect(rcc);
}
+ if (rcc->stream->watch) {
+ rcc->channel->core->watch_remove(rcc->stream->watch);
+ rcc->stream->watch = NULL;
+ }
reds_stream_free(rcc->stream);
rcc->stream = NULL;
red_channel_remove_client(rcc);
--
1.7.9.3
More information about the Spice-devel
mailing list