[gvfs/gnome-3-10] archive: Handle open failure
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-10] archive: Handle open failure
- Date: Sun, 27 Oct 2013 04:39:34 +0000 (UTC)
commit 1de81a47282e9dcf665237f0a508465e9d1f29a0
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Tue Oct 1 21:29:44 2013 +0200
archive: Handle open failure
If gvfs_archive_open fails, libarchive immediately calls
gvfs_archive_close which causes a crash due to calling g_object_unref on
the NULL stream.
https://bugzilla.gnome.org/show_bug.cgi?id=589028
daemon/gvfsbackendarchive.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendarchive.c b/daemon/gvfsbackendarchive.c
index 141f8f1..0dfe0fb 100644
--- a/daemon/gvfsbackendarchive.c
+++ b/daemon/gvfsbackendarchive.c
@@ -83,6 +83,7 @@ typedef struct {
GFile * file;
GFileInputStream *stream;
GVfsJob * job;
+ GVfsBackendArchive *backend;
GError * error;
guchar data[4096];
} GVfsArchive;
@@ -156,8 +157,9 @@ gvfs_archive_close (struct archive *archive,
GVfsArchive *d = data;
DEBUG ("CLOSE\n");
- g_object_unref (d->stream);
- d->stream = NULL;
+ if (!d->stream)
+ g_vfs_backend_force_unmount (G_VFS_BACKEND (d->backend));
+ g_clear_object (&d->stream);
return ARCHIVE_OK;
}
@@ -205,6 +207,7 @@ gvfs_archive_finish (GVfsArchive *archive)
{
gvfs_archive_pop_job (archive);
+ g_object_unref (archive->backend);
archive_read_free (archive->archive);
g_slice_free (GVfsArchive, archive);
}
@@ -217,6 +220,7 @@ gvfs_archive_new (GVfsBackendArchive *ba, GVfsJob *job)
d = g_slice_new0 (GVfsArchive);
+ d->backend = g_object_ref (ba);
d->file = ba->file;
gvfs_archive_push_job (d, job);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]