[gnome-directory-thumbnailer] core: Fix a potential assertion failure on an error handling path
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-directory-thumbnailer] core: Fix a potential assertion failure on an error handling path
- Date: Tue, 9 Jun 2015 11:37:04 +0000 (UTC)
commit 25c689462a6a97fc1a2d5fb4f22f7c1275f8b2e1
Author: Philip Withnall <philip withnall collabora co uk>
Date: Tue Jun 9 12:34:59 2015 +0100
core: Fix a potential assertion failure on an error handling path
If the enumeration loop iterates one or more times and chooses an
interesting_file, then encounters an error getting some file information
(which can happen part-way through enumeration with
GLocalFileEnumerator), it will throw an error. The error code previously
ignored existing interesting_files, and hence tripped the post-condition
assertion (child_error == NULL || interesting_file_info == NULL).
Fix that by ignoring errors if an interesting_file has already been
found.
https://retrace.fedoraproject.org/faf/problems/bthash/?bth=7c8a254ad589f1636cfc57d2921f51afba080609
src/main.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 86fc97c..f0c2364 100644
--- a/src/main.c
+++ b/src/main.c
@@ -261,8 +261,19 @@ pick_interesting_file_for_directory (GFile *input_directory, GFileInfo **file_in
g_file_enumerator_close (enumerator, NULL, NULL); /* ignore errors from this */
- /* Did we break out of the loop because of an error? */
+ /* Did we break out of the loop because of an error? If so, and we
+ * already have an interesting file, squash the error and continue with
+ * that file. */
if (child_error != NULL) {
+ if (interesting_file != NULL) {
+ gchar *path = g_file_get_path (input_directory);
+ g_debug ("Ignoring error enumerating directory ā%sā; "
+ "found interesting file already.", path);
+ g_free (path);
+
+ g_clear_error (&child_error);
+ }
+
goto done;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]