Re: [PATCH spice-gtk 1/2] SpiceUsbDeviceManager: propagate errors from sub-tasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Thu, Mar 24, 2016 at 03:29:23PM -0500, Jonathon Jongsma wrote:
> _connect_device_async_cb() just turned TRUE unconditionally even if the
> sub-task had failed. Instad, introduce a
> _spice_usb_device_manager_connect_device_finish() function which passes
> up the result of the subtask.
> ---
>  src/usb-device-manager.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index 1bbf6b3..cc95c68 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -1563,6 +1563,18 @@ _spice_usb_device_manager_uninstall_driver_async(SpiceUsbDeviceManager *self,
>  
>  #ifdef USE_USBREDIR
>  
> +static gboolean
> +_spice_usb_device_manager_connect_device_finish(SpiceUsbDeviceManager *self,
> +                                                GAsyncResult *res,
> +                                                GError **error)
> +{
> +    GTask *task = G_TASK(res);
> +
> +    g_return_val_if_fail(g_task_is_valid(task, G_OBJECT(self)), FALSE);
> +
> +    return g_task_propagate_boolean(task, error);
> +}
> +
>  static void
>  _spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
>                                                 SpiceUsbDevice *device,
> @@ -1727,10 +1739,13 @@ void _connect_device_async_cb(GObject *gobject,
>  {
>      SpiceUsbDeviceManager *self = SPICE_USB_DEVICE_MANAGER(gobject);
>      GTask *task = user_data;
> +    GError *error = NULL;
>  
>      _set_redirecting(self, FALSE);
> -
> -    g_task_return_boolean(task, TRUE);
> +    if (_spice_usb_device_manager_connect_device_finish(self, channel_res, &error))
> +        g_task_return_boolean(task, TRUE);
> +    else
> +        g_task_return_error(task, error);
>      g_object_unref(task);
>  }
>  #endif
> -- 
> 2.4.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]