gio: Update mounts after g_volume_mount

The documentation claims that g_volume_get_mount should	succeed	after
g_volume_mount. Let's update mounts before releasing g_volume_mount to
be sure that the mount is added to the corresponding volume. The same
is done in GVfsUDisks2VolumeMonitor.

https://gitlab.gnome.org/GNOME/glib/issues/1458
This commit is contained in:
Ondrej Holy
2018-07-30 15:26:31 +02:00
parent e5f87342e8
commit 9b6b282e0a
3 changed files with 19 additions and 10 deletions

View File

@@ -274,6 +274,7 @@ eject_mount_done (GObject *source,
GTask *task = user_data;
GError *error = NULL;
gchar *stderr_str;
GUnixVolume *unix_volume;
if (!g_subprocess_communicate_utf8_finish (subprocess, result, NULL, &stderr_str, &error))
{
@@ -286,8 +287,12 @@ eject_mount_done (GObject *source,
/* ...but bad exit code */
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
else
/* ...and successful exit code */
g_task_return_boolean (task, TRUE);
{
/* ...and successful exit code */
unix_volume = G_UNIX_VOLUME (g_task_get_source_object (task));
_g_unix_volume_monitor_update (G_UNIX_VOLUME_MONITOR (unix_volume->volume_monitor));
g_task_return_boolean (task, TRUE);
}
g_free (stderr_str);
}