diff options
author | Jonathon Jongsma <jjongsma@redhat.com> | 2016-03-02 11:04:42 -0600 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@redhat.com> | 2016-03-02 11:04:42 -0600 |
commit | 008324e08ed83f1c89523e0c87c073f7acdab148 (patch) | |
tree | a653106ae35c4daf1256e87085e03c6aca75a2a8 | |
parent | a6773066f6eb877ab52afc44bb36f5fd77e2d655 (diff) |
usb-acl-helper: Simplify cb_watch_outgtask
Since spice_usb_acl_helper_cleanup() only cancels the task in the case
where it has not yet been completed, it is fine to call this in the
success case as well as the failure case. Also, since _cleanup() already
clears the priv->task member, there's no need to clear it again after
calling _cleanup()
-rw-r--r-- | src/usb-acl-helper.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c index 705f0e9..839f23c 100644 --- a/src/usb-acl-helper.c +++ b/src/usb-acl-helper.c @@ -105,7 +105,6 @@ static gboolean cb_out_watch(GIOChannel *channel, { SpiceUsbAclHelper *self = SPICE_USB_ACL_HELPER(user_data); SpiceUsbAclHelperPrivate *priv = self->priv; - gboolean success = FALSE; GError *err = NULL; GIOStatus status; gchar *string; @@ -122,7 +121,6 @@ static gboolean cb_out_watch(GIOChannel *channel, case G_IO_STATUS_NORMAL: string[strlen(string) - 1] = 0; if (!strcmp(string, "SUCCESS")) { - success = TRUE; g_task_return_boolean(priv->task, TRUE); } else if (!strcmp(string, "CANCELED")) { async_result_set_cancelled(priv->task); @@ -146,10 +144,7 @@ static gboolean cb_out_watch(GIOChannel *channel, return TRUE; /* Wait for more input */ } - if (!success) - spice_usb_acl_helper_cleanup(self); - - g_clear_object(&priv->task); + spice_usb_acl_helper_cleanup(self); done: g_object_unref(self); |