summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendarchive.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2011-03-16 17:20:52 +0100
committerTomas Bzatek <tbzatek@redhat.com>2011-03-16 17:20:52 +0100
commit024159a433ba3eabd83425c27e06818d315dc6b9 (patch)
tree880eab6cea291b5a7b14b2133d84c1df9c288286 /daemon/gvfsbackendarchive.c
parent8bfd933e98c74af026659213dd53e9fd0c41358e (diff)
downloadgvfs-024159a433ba3eabd83425c27e06818d315dc6b9.tar.gz
archive: Prevent assertion failure on duplicate mount
This will fix an abort when archive is to be mounted for the second time: ERROR:gvfsbackendarchive.c:240:g_vfs_backend_archive_finalize: assertion failed: (archive->file == NULL) https://bugzilla.redhat.com/show_bug.cgi?id=645630
Diffstat (limited to 'daemon/gvfsbackendarchive.c')
-rw-r--r--daemon/gvfsbackendarchive.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/daemon/gvfsbackendarchive.c b/daemon/gvfsbackendarchive.c
index 24547441..50aa176c 100644
--- a/daemon/gvfsbackendarchive.c
+++ b/daemon/gvfsbackendarchive.c
@@ -73,6 +73,8 @@ struct _GVfsBackendArchive
G_DEFINE_TYPE (GVfsBackendArchive, g_vfs_backend_archive, G_VFS_TYPE_BACKEND)
+static void backend_unmount (GVfsBackendArchive *ba);
+
/*** AN ARCHIVE WE CAN OPERATE ON ***/
typedef struct {
@@ -237,7 +239,7 @@ g_vfs_backend_archive_finalize (GObject *object)
{
GVfsBackendArchive *archive = G_VFS_BACKEND_ARCHIVE (object);
- g_assert (archive->file == NULL);
+ backend_unmount (archive);
if (G_OBJECT_CLASS (g_vfs_backend_archive_parent_class)->finalize)
(*G_OBJECT_CLASS (g_vfs_backend_archive_parent_class)->finalize) (object);
@@ -589,17 +591,27 @@ do_mount (GVfsBackend *backend,
}
static void
+backend_unmount (GVfsBackendArchive *ba)
+{
+ if (ba->file)
+ {
+ g_object_unref (ba->file);
+ ba->file = NULL;
+ }
+ if (ba->files)
+ {
+ archive_file_free (ba->files);
+ ba->files = NULL;
+ }
+}
+
+static void
do_unmount (GVfsBackend *backend,
GVfsJobUnmount *job,
GMountUnmountFlags flags,
GMountSource *mount_source)
{
- GVfsBackendArchive *ba = G_VFS_BACKEND_ARCHIVE (backend);
-
- g_object_unref (ba->file);
- ba->file = NULL;
- archive_file_free (ba->files);
- ba->files = NULL;
+ backend_unmount (G_VFS_BACKEND_ARCHIVE (backend));
g_vfs_job_succeeded (G_VFS_JOB (job));
}