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

Jonathon Jongsma jjongsma at redhat.com
Tue Mar 29 15:25:37 UTC 2016


Thanks, I've pushed these along with the other usbdk patches from Dmitry and
Kirill


On Tue, 2016-03-29 at 16:49 +0200, Christophe Fergeau wrote:
> Acked-by: Christophe Fergeau <cfergeau at redhat.com>
> 
> 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


More information about the Spice-devel mailing list