<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jonathon,<div class=""><br class=""></div><div class="">Sure, I’ll test.</div><div class="">I tried to build your branch but it requires newer spice-protocol:</div><div class=""><br class=""></div><div class=""><div class="">configure: error: Package requirements (spice-protocol >= 0.12.11) were not met:</div><div class="">Requested 'spice-protocol >= 0.12.11' but version of spice-protocol is 0.12.10</div><div class=""><br class=""></div><div class="">Do you have any idea where one can get the corresponding mingw package?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Dmitry</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On 17 Mar 2016, at 24:04 AM, Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" class="">jjongsma@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Wed, 2016-03-16 at 23:01 +0100, Fabiano Fidêncio wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On Wed, Mar 16, 2016 at 10:54 PM, Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" class="">jjongsma@redhat.com</a>><br class="">wrote:<br class=""><blockquote type="cite" class="">Updated proposal:<br class=""><br class="">--- a/src/channel-usbredir.c<br class="">+++ b/src/channel-usbredir.c<br class="">@@ -368,16 +368,19 @@ _open_device_async_cb(GTask *task,<br class=""> spice_usbredir_channel_lock(channel);<br class=""><br class=""> if (!spice_usbredir_channel_open_device(channel, &err)) {<br class="">- g_task_return_error(task, err);<br class=""> libusb_unref_device(priv->device);<br class=""> priv->device = NULL;<br class=""> g_boxed_free(spice_usb_device_get_type(), priv->spice_device);<br class=""> priv->spice_device = NULL;<br class="">- } else {<br class="">- g_task_return_boolean(task, TRUE);<br class=""> }<br class=""><br class=""> spice_usbredir_channel_unlock(channel);<br class="">+<br class="">+ if (err) {<br class="">+ g_task_return_error(task, err);<br class="">+ } else {<br class="">+ g_task_return_boolean(task, TRUE);<br class="">+ }<br class="">}<br class="">#endif<br class=""></blockquote><br class="">ACK from my side. But I really would like to have Dmitry doing a last<br class="">round of tests on his series, this time with this GTask changes<br class="">applied.<br class="">Does it sound reasonable?<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Absolutely. my rebased branch is available here:<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://cgit.freedesktop.org/~jjongsma/spice-gtk/log/?h=usb-async" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://cgit.freedesktop.org/~jjongsma/spice-gtk/log/?h=usb-async</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class=""><br class=""><br class=""><br class="">On Wed, 2016-03-16 at 16:44 -0500, Jonathon Jongsma wrote:<br class=""><blockquote type="cite" class="">On Wed, 2016-03-16 at 10:41 -0500, Jonathon Jongsma wrote:<br class=""><blockquote type="cite" class="">So, after adding the g_task_return_boolean back to<br class="">_open_device_async_cb(),<br class="">I<br class="">noticed that since g_task_return_error() can potentially complete the<br class="">task<br class="">immediately (rather than in an idle handler done previously), we may be<br class="">executing the GAsyncReadyCallback while the channel is locked.<br class="">Currently, I<br class="">don't think this causes any problems, but if the callback did anything<br class="">that<br class="">required locking the channel's mutex, that could result in a deadlock.<br class="">So<br class="">here's<br class="">an additional proposed patch to unlock before completing the task. If<br class="">this<br class="">change is ACKed, I'd probably squash it into this patch.<br class=""><br class="">------------<br class="">diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c<br class="">index cd2ff4f..aa8e943 100644<br class="">--- a/src/channel-usbredir.c<br class="">+++ b/src/channel-usbredir.c<br class="">@@ -367,17 +367,19 @@ _open_device_async_cb(GTask *task,<br class=""><br class=""> spice_usbredir_channel_lock(channel);<br class=""><br class="">- if (!spice_usbredir_channel_open_device(channel, &err)) {<br class="">+ spice_usbredir_channel_open_device(channel, &err);<br class="">+ libusb_unref_device(priv->device);<br class="">+ priv->device = NULL;<br class="">+ g_boxed_free(spice_usb_device_get_type(), priv->spice_device);<br class="">+ priv->spice_device = NULL;<br class="">+<br class="">+ spice_usbredir_channel_unlock(channel);<br class="">+<br class="">+ if (err) {<br class=""> g_task_return_error(task, err);<br class="">- libusb_unref_device(priv->device);<br class="">- priv->device = NULL;<br class="">- g_boxed_free(spice_usb_device_get_type(), priv->spice_device);<br class="">- priv->spice_device = NULL;<br class=""> } else {<br class=""> g_task_return_boolean(task, TRUE);<br class=""> }<br class="">-<br class="">- spice_usbredir_channel_unlock(channel);<br class="">}<br class="">#endif<br class=""><br class=""></blockquote><br class="">... And Fabiano pointed out that this patch is incorrect since it frees<br class="">the<br class="">device even if it was successfully redirected. That's clearly wrong. New<br class="">patch<br class="">coming.<br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class=""><br class="">On Wed, 2016-03-16 at 10:16 -0500, Jonathon Jongsma wrote:<br class=""><blockquote type="cite" class="">On Wed, 2016-03-16 at 11:27 +0100, Christophe Fergeau wrote:<br class=""><blockquote type="cite" class="">Hey,<br class=""><br class="">On Tue, Mar 15, 2016 at 02:31:03PM -0500, Jonathon Jongsma wrote:<br class=""><blockquote type="cite" class="">+#ifndef USE_POLKIT<br class="">+static void<br class="">+_open_device_async_cb(GTask *task,<br class="">+ gpointer object,<br class="">+ gpointer task_data,<br class="">+ GCancellable *cancellable)<br class="">+{<br class="">+ GError *err = NULL;<br class="">+ SpiceUsbredirChannel *channel =<br class="">SPICE_USBREDIR_CHANNEL(object);<br class="">+ SpiceUsbredirChannelPrivate *priv = channel->priv;<br class="">+<br class="">+ spice_usbredir_channel_lock(channel);<br class="">+<br class="">+ if (!spice_usbredir_channel_open_device(channel, &err)) {<br class="">+ g_task_return_error(task, err);<br class="">+ libusb_unref_device(priv->device);<br class="">+ priv->device = NULL;<br class="">+ g_boxed_free(spice_usb_device_get_type(), priv<br class="">->spice_device);<br class="">+ priv->spice_device = NULL;<br class="">+ }<br class="">+<br class="">+ spice_usbredir_channel_unlock(channel);<br class="">+}<br class="">+#endif<br class="">+<br class="">G_GNUC_INTERNAL<br class="">void spice_usbredir_channel_connect_device_async(<br class=""> SpiceUsbredirChannel<br class="">*channel,<br class="">@@ -331,9 +356,6 @@ void<br class="">spice_usbredir_channel_connect_device_async(<br class="">{<br class=""> SpiceUsbredirChannelPrivate *priv = channel->priv;<br class=""> GTask *task;<br class="">-#ifndef USE_POLKIT<br class="">- GError *err = NULL;<br class="">-#endif<br class=""><br class=""> g_return_if_fail(SPICE_IS_USBREDIR_CHANNEL(channel));<br class=""> g_return_if_fail(device != NULL);<br class="">@@ -376,15 +398,7 @@ void<br class="">spice_usbredir_channel_connect_device_async(<br class=""> channel);<br class=""> return;<br class="">#else<br class="">- if (!spice_usbredir_channel_open_device(channel, &err)) {<br class="">- g_task_return_error(task, err);<br class="">- libusb_unref_device(priv->device);<br class="">- priv->device = NULL;<br class="">- g_boxed_free(spice_usb_device_get_type(), priv<br class="">->spice_device);<br class="">- priv->spice_device = NULL;<br class="">- } else {<br class="">- g_task_return_boolean(task, TRUE);<br class=""></blockquote><br class="">Only looked at the diff, not at the full code, but this<br class="">g_task_return_boolean(task, TRUE); is gone from the threaded<br class="">version, is<br class="">this intentional?<br class=""><br class=""></blockquote><br class="">Good catch. That was unintentional.<br class=""><br class=""><br class=""><blockquote type="cite" class="">Christophe<br class=""></blockquote>_______________________________________________<br class="">Spice-devel mailing list<br class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a><br class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel<br class=""></blockquote>_______________________________________________<br class="">Spice-devel mailing list<br class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a><br class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel<br class=""></blockquote>_______________________________________________<br class="">Spice-devel mailing list<br class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a><br class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel<br class=""></blockquote>_______________________________________________<br class="">Spice-devel mailing list<br class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a><br class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel</blockquote></blockquote></div></blockquote></div><br class=""></div></body></html>