mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-27 07:29:32 +00:00
snd_worker/snd_disconnect_channel: don't call snd_channel_put if the channel has already been disconnected
The snd channels has one reference as long as their socket is active. The playback channel has an additional reference for each frame that is currently filled by the sound device. Once the channel is disconnected (the socket has been freed and the first reference is released) snd_disconnect_channel shouldn't release a reference again.
This commit is contained in:
parent
134b7f310d
commit
02f44c137d
@ -212,21 +212,20 @@ static void snd_disconnect_channel(SndChannel *channel)
|
||||
{
|
||||
SndWorker *worker;
|
||||
|
||||
if (!channel) {
|
||||
if (!channel || !channel->stream) {
|
||||
spice_debug("not connected");
|
||||
return;
|
||||
}
|
||||
spice_debug("%p", channel);
|
||||
worker = channel->worker;
|
||||
if (channel->stream) {
|
||||
channel->cleanup(channel);
|
||||
red_channel_client_disconnect(worker->connection->channel_client);
|
||||
core->watch_remove(channel->stream->watch);
|
||||
channel->stream->watch = NULL;
|
||||
reds_stream_free(channel->stream);
|
||||
channel->stream = NULL;
|
||||
spice_marshaller_destroy(channel->send_data.marshaller);
|
||||
}
|
||||
channel->cleanup(channel);
|
||||
red_channel_client_disconnect(worker->connection->channel_client);
|
||||
worker->connection->channel_client = NULL;
|
||||
core->watch_remove(channel->stream->watch);
|
||||
channel->stream->watch = NULL;
|
||||
reds_stream_free(channel->stream);
|
||||
channel->stream = NULL;
|
||||
spice_marshaller_destroy(channel->send_data.marshaller);
|
||||
snd_channel_put(channel);
|
||||
worker->connection = NULL;
|
||||
}
|
||||
@ -897,6 +896,7 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
|
||||
int tos;
|
||||
MainChannelClient *mcc = red_client_get_main(client);
|
||||
|
||||
spice_assert(stream);
|
||||
if ((flags = fcntl(stream->socket, F_GETFL)) == -1) {
|
||||
spice_printerr("accept failed, %s", strerror(errno));
|
||||
goto error1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user