After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781831 - places-menu: Uses blocking Gio.AppInfo.launch_default_for_uri for opening network shares
places-menu: Uses blocking Gio.AppInfo.launch_default_for_uri for opening net...
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: extensions
3.24.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2017-04-27 12:33 UTC by Benjamin Berg
Modified: 2017-04-28 13:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
make launching asynchronous (3.01 KB, patch)
2017-04-28 09:10 UTC, Christian Kellner
none Details | Review
report errors for mounting of volumes (1.58 KB, patch)
2017-04-28 09:11 UTC, Christian Kellner
none Details | Review
make launching asynchronous (2.98 KB, patch)
2017-04-28 12:54 UTC, Christian Kellner
none Details | Review
report errors for mounting of volumes (1.58 KB, patch)
2017-04-28 12:55 UTC, Christian Kellner
committed Details | Review
make launching asynchronous (2.98 KB, patch)
2017-04-28 13:04 UTC, Christian Kellner
none Details | Review
make launching asynchronous (2.98 KB, patch)
2017-04-28 13:17 UTC, Christian Kellner
committed Details | Review

Description Benjamin Berg 2017-04-27 12:33:57 UTC
When opening bookmarks on network shares than the call to Gio.AppInfo.launch_default_for_uri may block indefinitely. The async API should be used instead to prevent the whole shell from locking up pending on an unresponsive network share.

This is similar to bug #781765.
Comment 1 Christian Kellner 2017-04-28 09:10:32 UTC
Created attachment 350620 [details] [review]
make launching asynchronous

Not as straight forward as bug #781765 because of all the nesting that is going on. I also used the "self = this" trick instead of having nested Lang.bind. Hope that is ok.
Comment 2 Christian Kellner 2017-04-28 09:11:47 UTC
Created attachment 350621 [details] [review]
report errors for mounting of volumes

Technically not part of the bug, but I noticed we don't report any errors when mounting fails,.
Comment 3 Florian Müllner 2017-04-28 12:26:38 UTC
Review of attachment 350620 [details] [review]:

::: extensions/places-menu/placeDisplay.js
@@ +45,3 @@
     },
 
+    _launch_async_handler: function (launchContext, try_mount) {

Style nit: camelCase. I'm not very happy with the launchAsyncHandler name either, as the function is not a handler, but returns one. _createLaunchCallback() maybe?

@@ +47,3 @@
+    _launch_async_handler: function (launchContext, try_mount) {
+        let self = this;
+        return function(_ignored, result) {

Did you try arrow notation instead of the "self = this" hack?

return (ignored, result) => {
   ...
}
Comment 4 Florian Müllner 2017-04-28 12:32:07 UTC
Review of attachment 350621 [details] [review]:

Sure
Comment 5 Christian Kellner 2017-04-28 12:54:31 UTC
Created attachment 350637 [details] [review]
make launching asynchronous

Did not know about the arrow notation - I am not much of a JS guru (yet?). Happy to report that it works. ;)
Comment 6 Christian Kellner 2017-04-28 12:55:28 UTC
Created attachment 350638 [details] [review]
report errors for mounting of volumes

Update to use arrow notation.
Comment 7 Christian Kellner 2017-04-28 12:56:23 UTC
NB: g_app_info_launch_default_for_uri_async requires glib 2.50.
Comment 8 Christian Kellner 2017-04-28 13:04:09 UTC
Created attachment 350639 [details] [review]
make launching asynchronous

Also update the name, doh! Completely agree that _createLaunchCallback() is reflecting more what is going on.
Comment 9 Florian Müllner 2017-04-28 13:10:06 UTC
Review of attachment 350639 [details] [review]:

::: extensions/places-menu/placeDisplay.js
@@ +45,3 @@
     },
 
+    _createLaunchCallback: function(launchContext, try_mount) {

Style nit: camelCase (sorry, should have mentioned that the comment in the last review referred to both the method name and the try_mount parameter)
Comment 10 Florian Müllner 2017-04-28 13:10:15 UTC
Review of attachment 350638 [details] [review]:

Still ACN
Comment 11 Christian Kellner 2017-04-28 13:17:53 UTC
Created attachment 350640 [details] [review]
make launching asynchronous

Sorry, mea culpa, I should have seen that. Hope it is ok now.
Comment 12 Florian Müllner 2017-04-28 13:22:50 UTC
(In reply to Christian Kellner from comment #7)
> NB: g_app_info_launch_default_for_uri_async requires glib 2.50.

Yeah, I saw that - the build system glue that generates the extension metadata marks extensions as compatible only with the matching gnome-shell version. So users on older gnome versions won't see the update, and assuming the GIO version shipped with 3.22 for 3.25.x users looks perfectly reasonable to me.
Comment 13 Florian Müllner 2017-04-28 13:23:39 UTC
Review of attachment 350640 [details] [review]:

LGTM
Comment 14 Christian Kellner 2017-04-28 13:39:22 UTC
Committed to master, thanks for you patience. ;)