[gvfs] gphoto2: Initialize mutex early enough
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] gphoto2: Initialize mutex early enough
- Date: Wed, 11 Apr 2012 11:11:36 +0000 (UTC)
commit 31b80beeb44a69d227f9420d69cdf1780f6191bf
Author: Martin Pitt <martinpitt gnome org>
Date: Wed Apr 11 12:11:34 2012 +0200
gphoto2: Initialize mutex early enough
Initializing the lock mutex in do_mount() is too late, as there are a lot of
code paths that call release_device() and thus g_mutex_clear() that run before
a successful do_mount(). For example, when you run gvfsd-gphoto2 with wrong
arguments, or gp_camera_init() fails in do_mount().
Now initialize it in g_vfs_backend_gphoto2_init().
https://bugzilla.gnome.org/show_bug.cgi?id=673893
daemon/gvfsbackendgphoto2.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 403d5e7..a0d59c4 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -659,6 +659,8 @@ g_vfs_backend_gphoto2_init (GVfsBackendGphoto2 *gphoto2_backend)
DEBUG ("initing %p", gphoto2_backend);
+ g_mutex_init (&gphoto2_backend->lock);
+
g_vfs_backend_set_display_name (backend, "gphoto2");
mount_spec = g_mount_spec_new ("gphoto2");
@@ -1712,8 +1714,6 @@ do_mount (GVfsBackend *backend,
gphoto2_backend->free_space = -1;
- g_mutex_init (&gphoto2_backend->lock);
-
gphoto2_mount_spec = g_mount_spec_new ("gphoto2");
g_mount_spec_set (gphoto2_mount_spec, "host", host);
g_vfs_backend_set_mount_spec (backend, gphoto2_mount_spec);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]