From 4e9d1673e402f8b72cc55e149e7c3718e86c5aef Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 20 Jul 2008 02:49:45 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20543040=20=E2=80=93=20async=20reading=20on?= =?UTF-8?q?=20dummy=20file=20will=20crash=20on=20GIO=5FUSE=5FVFS=3Dlocal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 543040 – async reading on dummy file will crash on GIO_USE_VFS=local * gfile.c (open_read_async_thread): Cope with read_fn being NULL. Reported by Lin Ma. svn path=/branches/glib-2-16/; revision=7213 --- gio/ChangeLog | 10 ++++++++++ gio/gfile.c | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gio/ChangeLog b/gio/ChangeLog index d5829bc81..43a5946f8 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,13 @@ +2008-07-19 Matthias Clasen + + Merge from trunk: + + Bug 543040 – async reading on dummy file will crash on + GIO_USE_VFS=local + + * gfile.c (open_read_async_thread): Cope with read_fn being + NULL. Reported by Lin Ma. + 2008-07-19 Matthias Clasen Merge from trunk: diff --git a/gio/gfile.c b/gio/gfile.c index a240688d9..988beda9a 100644 --- a/gio/gfile.c +++ b/gio/gfile.c @@ -4012,6 +4012,18 @@ open_read_async_thread (GSimpleAsyncResult *res, iface = G_FILE_GET_IFACE (object); + if (iface->read_fn == NULL) + { + g_set_error_literal (error, G_IO_ERROR, + G_IO_ERROR_NOT_SUPPORTED, + _("Operation not supported")); + + g_simple_async_result_set_from_error (res, error); + g_error_free (error); + + return; + } + stream = iface->read_fn (G_FILE (object), cancellable, &error); if (stream == NULL)