mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-12 10:14:53 +00:00
sound: free SndChannel data in finalize()
Move the freeing of SndChannel data members from snd_detach_common() to the finalize function to encapsulate things a bit more cleanly. It doesn't really change the behavior or order of destruction since snd_detach_common() destroys the channel. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
b7e4703140
commit
92c051a820
@ -1439,11 +1439,27 @@ snd_channel_init(SndChannel *self)
|
||||
self->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */
|
||||
}
|
||||
|
||||
static void
|
||||
snd_channel_finalize(GObject *object)
|
||||
{
|
||||
SndChannel *channel = SND_CHANNEL(object);
|
||||
|
||||
remove_channel(channel);
|
||||
|
||||
free(channel->volume.volume);
|
||||
channel->volume.volume = NULL;
|
||||
|
||||
G_OBJECT_CLASS(snd_channel_parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
static void
|
||||
snd_channel_class_init(SndChannelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
|
||||
|
||||
object_class->finalize = snd_channel_finalize;
|
||||
|
||||
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;
|
||||
@ -1559,10 +1575,7 @@ static void snd_detach_common(SndChannel *channel)
|
||||
}
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(channel));
|
||||
|
||||
remove_channel(channel);
|
||||
reds_unregister_channel(reds, RED_CHANNEL(channel));
|
||||
free(channel->volume.volume);
|
||||
channel->volume.volume = NULL;
|
||||
red_channel_destroy(RED_CHANNEL(channel));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user