[gvfs] GVfsJobUnmount: check that vfunc is implemented before calling it
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] GVfsJobUnmount: check that vfunc is implemented before calling it
- Date: Tue, 7 Feb 2012 14:27:53 +0000 (UTC)
commit e523572e14a9042696e1c5ccd4f30cb3240fa0df
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Feb 7 15:25:05 2012 +0100
GVfsJobUnmount: check that vfunc is implemented before calling it
GVfsBackend::try_unmount is optional (like all the other try_* vfuncs),
and in fact many backends don't implement it.
In case it's NULL, returing FALSE does the right thing and schedules
a thread for calling ->unmount.
https://bugzilla.gnome.org/show_bug.cgi?id=669211
daemon/gvfsjobunmount.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsjobunmount.c b/daemon/gvfsjobunmount.c
index d31b36e..85873f9 100644
--- a/daemon/gvfsjobunmount.c
+++ b/daemon/gvfsjobunmount.c
@@ -130,6 +130,9 @@ run (GVfsJob *job)
GVfsJobUnmount *op_job = G_VFS_JOB_UNMOUNT (job);
GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend);
+ if (class->unmount == NULL)
+ return;
+
class->unmount (op_job->backend,
op_job,
op_job->flags,
@@ -218,11 +221,13 @@ try (GVfsJob *job)
if (job_finish_immediately_if_possible (op_job))
return TRUE;
- else
+ else if (class->try_unmount != NULL)
return class->try_unmount (op_job->backend,
op_job,
op_job->flags,
op_job->mount_source);
+ else
+ return FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]