[Spice-devel] [vdagent-win PATCH v5 3/6] Introduce an helper to close VirtIo device
Christophe Fergeau
cfergeau at redhat.com
Wed Jul 18 09:26:45 UTC 2018
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
On Mon, Jul 09, 2018 at 09:51:41AM +0100, Frediano Ziglio wrote:
> Do not assume we allocated the handle doing the cleanup.
> This utility will be reused in next patch.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> Acked-by: Christophe de Dinechin <dinechin at redhat.com>
> ---
> vdagent/vdagent.cpp | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
> index 010e73b..d603dda 100644
> --- a/vdagent/vdagent.cpp
> +++ b/vdagent/vdagent.cpp
> @@ -110,6 +110,7 @@ private:
> bool write_message(uint32_t type, uint32_t size, void* data);
> bool write_clipboard(VDAgentMessage* msg, uint32_t size);
> bool init_vio_serial();
> + void close_vio_serial();
> bool send_input();
> void set_display_depth(uint32_t depth);
> void load_display_setting();
> @@ -340,7 +341,7 @@ bool VDAgent::run()
>
> void VDAgent::cleanup()
> {
> - CloseHandle(_vio_serial);
> + close_vio_serial();
> }
>
> void VDAgent::set_control_event(control_command_t control_command)
> @@ -1224,6 +1225,14 @@ bool VDAgent::init_vio_serial()
> return true;
> }
>
> +void VDAgent::close_vio_serial()
> +{
> + if (_vio_serial != INVALID_HANDLE_VALUE) {
> + CloseHandle(_vio_serial);
> + _vio_serial = INVALID_HANDLE_VALUE;
> + }
> +}
> +
> void VDAgent::dispatch_message(VDAgentMessage* msg, uint32_t port)
> {
> bool res = true;
> --
> 2.17.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180718/8735acb9/attachment.sig>
More information about the Spice-devel
mailing list