]> git.ipfire.org Git - thirdparty/qemu.git/commit
io: move websock resource release to close method
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 30 Sep 2025 10:58:35 +0000 (11:58 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 24 Oct 2025 12:04:31 +0000 (13:04 +0100)
commit322c3c4f3abee616a18b3bfe563ec29dd67eae63
tree39055859859a8c01e0f3ef4588e9347d9eef3cd8
parent2c147611cf568eb1cd7dc8bf4479b272bad3b9d6
io: move websock resource release to close method

The QIOChannelWebsock object releases all its resources in the
finalize callback. This is later than desired, as callers expect
to be able to call qio_channel_close() to fully close a channel
and release resources related to I/O.

The logic in the finalize method is at most a failsafe to handle
cases where a consumer forgets to call qio_channel_close.

This adds equivalent logic to the close method to release the
resources, using g_clear_handle_id/g_clear_pointer to be robust
against repeated invocations. The finalize method is tweaked
so that the GSource is removed before releasing the underlying
channel.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
io/channel-websock.c