diff options
author | Ondrej Holy <oholy@redhat.com> | 2018-02-16 10:13:22 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2018-02-19 13:24:39 +0100 |
commit | dec2f32531872014a99a318fb18f9bb889e6c8d0 (patch) | |
tree | 6bdac832c4f4e231aa183255ab50391d99f0ac54 | |
parent | f3bb2f809dd95582a53befe3474ccc69238647cf (diff) | |
download | gvfs-dec2f32531872014a99a318fb18f9bb889e6c8d0.tar.gz |
mtp: Handle uevents only in case of mount success
Uevents handler can be connected even if mount operation failed (e.g.
device is unplugged in the middle of mount operation). Backend is
consequently finalized, however, g_vfs_backend_force_unmount can be
still called from on_uevent in the meantime. This might cause segfaults
in certain cases.
https://bugzilla.gnome.org/show_bug.cgi?id=787992
-rw-r--r-- | daemon/gvfsbackendmtp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c index 556a1975..5469763e 100644 --- a/daemon/gvfsbackendmtp.c +++ b/daemon/gvfsbackendmtp.c @@ -931,14 +931,14 @@ do_mount (GVfsBackend *backend, op_backend->volume_symbolic_icon = g_vfs_get_volume_symbolic_icon (device); g_object_unref (device); - g_signal_connect (op_backend->gudev_client, "uevent", G_CALLBACK (on_uevent), op_backend); - - op_backend->file_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - LIBMTP_Init (); get_device (backend, host, G_VFS_JOB (job)); if (!G_VFS_JOB (job)->failed) { + g_signal_connect (op_backend->gudev_client, "uevent", G_CALLBACK (on_uevent), op_backend); + + op_backend->file_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + GMountSpec *mtp_mount_spec = g_mount_spec_new ("mtp"); g_mount_spec_set (mtp_mount_spec, "host", host); g_vfs_backend_set_mount_spec (backend, mtp_mount_spec); |