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 708753 - gdesktopappinfo: Call g_file_get_path() on demand
gdesktopappinfo: Call g_file_get_path() on demand
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-09-25 14:16 UTC by Bastien Nocera
Modified: 2013-09-27 07:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdesktopappinfo: Call g_file_get_path() on demand (1.65 KB, patch)
2013-09-25 14:16 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2013-09-25 14:16:25 UTC
Rather than always calling out to g_file_get_path() (which
might block, whatever the documentation might say), postpone
the call until we actually need it.
Comment 1 Bastien Nocera 2013-09-25 14:16:28 UTC
Created attachment 255690 [details] [review]
gdesktopappinfo: Call g_file_get_path() on demand
Comment 2 Alexander Larsson 2013-09-26 07:58:02 UTC
Yeah, this is somewhat unfortunate in the gvfs implementation:

static char *
g_daemon_file_get_path (GFile *file)
{
  GDaemonFile *daemon_file = G_DAEMON_FILE (file);
  GMountInfo *mount_info;
  const char *rel_path;
  char *path;

  /* This is a sync i/o call, which is a bit unfortunate, as
   * this is supposed to be a fast call. However, in almost all
   * cases this will be cached.
   */
  mount_info = _g_daemon_vfs_get_mount_info_sync (daemon_file->mount_spec,
						  daemon_file->path,
						  NULL,  /* TODO: cancellable */
						  NULL);

This is needed to support the to-fuse path conversion.

So, this will block the first time we're doing i/o on a particular mount for this thread.

I don't really see how we could avoid this though, and returning the fuse path here is kind of important...
Comment 3 Alexander Larsson 2013-09-26 07:59:41 UTC
Review of attachment 255690 [details] [review]:

Looks good to me. Safe and slightly better than before.
Comment 4 Alexander Larsson 2013-09-27 07:53:36 UTC
Attachment 255690 [details] pushed as 2d8e5ef - gdesktopappinfo: Call g_file_get_path() on demand