[gvfs] gphoto2: Disconnect uevent handler immediately
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] gphoto2: Disconnect uevent handler immediately
- Date: Fri, 27 Jan 2017 07:21:27 +0000 (UTC)
commit d864620faa2ec65701244a8a216ddfbe3e5bb1e5
Author: Ondrej Holy <oholy redhat com>
Date: Thu Jan 26 15:06:15 2017 +0100
gphoto2: Disconnect uevent handler immediately
Uevent handler with "remove" action may be called multiple times,
which causes that g_vfs_backend_force_unmount is called several
times, which may lead to segfault. Disconnect the uevent handler
immediately after g_vfs_backend_force_unmount call.
https://bugzilla.gnome.org/show_bug.cgi?id=777794
daemon/gvfsbackendgphoto2.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 54a6f8a..88e2389 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -748,6 +748,8 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
caches_invalidate_all (gphoto2_backend);
g_vfs_backend_force_unmount (G_VFS_BACKEND (gphoto2_backend));
+
+ g_signal_handlers_disconnect_by_func (gphoto2_backend->gudev_client, on_uevent, gphoto2_backend);
}
}
@@ -1421,6 +1423,18 @@ do_mount (GVfsBackend *backend,
g_debug (" mounted %p\n", gphoto2_backend);
}
+static void
+do_unmount (GVfsBackend *backend, GVfsJobUnmount *job,
+ GMountUnmountFlags flags,
+ GMountSource *mount_source)
+{
+ GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (backend);
+
+ g_signal_handlers_disconnect_by_func (gphoto2_backend->gudev_client, on_uevent, gphoto2_backend);
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+}
+
/* ------------------------------------------------------------------------------------------------- */
static gboolean
@@ -3416,7 +3430,8 @@ g_vfs_backend_gphoto2_class_init (GVfsBackendGphoto2Class *klass)
backend_class->try_mount = try_mount;
backend_class->mount = do_mount;
- backend_class->open_icon_for_read = do_open_icon_for_read;
+ backend_class->unmount = do_unmount;
+ backend_class->open_icon_for_read = do_open_icon_for_read;
backend_class->open_for_read = do_open_for_read;
backend_class->try_read = try_read;
backend_class->try_seek_on_read = try_seek_on_read;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]