diff options
author | Benjamin Otte <otte@gnome.org> | 2008-02-26 09:39:24 +0000 |
---|---|---|
committer | Benjamin Otte <otte@src.gnome.org> | 2008-02-26 09:39:24 +0000 |
commit | f23d03915ee0bf49b8970a339cb665333a7299da (patch) | |
tree | 9ae01825c2f45d6e68291e34225e74759e5f8201 /daemon | |
parent | 1b19f26b1cdd5569d3bad8afdb526542364a2086 (diff) | |
download | gvfs-f23d03915ee0bf49b8970a339cb665333a7299da.tar.gz |
use ref/unref pair to stop backend from going away when the mount fails
2008-02-26 Benjamin Otte <otte@gnome.org>
* daemon/gvfsjobmount.c: (run), (try):
use ref/unref pair to stop backend from going away when the mount
fails
svn path=/trunk/; revision=1386
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/gvfsjobmount.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/daemon/gvfsjobmount.c b/daemon/gvfsjobmount.c index c24a7a79..ca2d69e5 100644 --- a/daemon/gvfsjobmount.c +++ b/daemon/gvfsjobmount.c @@ -97,7 +97,8 @@ static void run (GVfsJob *job) { GVfsJobMount *op_job = G_VFS_JOB_MOUNT (job); - GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend); + GVfsBackend *backend = op_job->backend; + GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (backend); if (class->mount == NULL) { @@ -106,27 +107,34 @@ run (GVfsJob *job) return; } - class->mount (op_job->backend, + g_object_ref (backend); + class->mount (backend, op_job, op_job->mount_spec, op_job->mount_source, op_job->is_automount); + g_object_unref (backend); } static gboolean try (GVfsJob *job) { GVfsJobMount *op_job = G_VFS_JOB_MOUNT (job); - GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend); + GVfsBackend *backend = op_job->backend; + GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (backend); + gboolean result; if (class->try_mount == NULL) return FALSE; - return class->try_mount (op_job->backend, - op_job, - op_job->mount_spec, - op_job->mount_source, - op_job->is_automount); + g_object_ref (backend); + result = class->try_mount (backend, + op_job, + op_job->mount_spec, + op_job->mount_source, + op_job->is_automount); + g_object_unref (backend); + return result; } static void |