[gimp] Bug 784502 - Multiple identical path entries for resources cause...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 784502 - Multiple identical path entries for resources cause...
- Date: Sat, 8 Jul 2017 10:51:56 +0000 (UTC)
commit 8294ca9d21c6c4c3eb6e0d08e557246549088057
Author: Michael Natterer <mitch gimp org>
Date: Sat Jul 8 12:50:37 2017 +0200
Bug 784502 - Multiple identical path entries for resources cause...
...resources to be loaded and shown multiple times
Change gimp_path_parse() to filter out duplicate paths. This is the
function at the bottom which is used by everything else, so should
generically catch all duplicates.
libgimpbase/gimpenv.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c
index 1f62bb1..a8bc641 100644
--- a/libgimpbase/gimpenv.c
+++ b/libgimpbase/gimpenv.c
@@ -957,9 +957,24 @@ gimp_path_parse (const gchar *path,
exists = g_file_test (dir->str, G_FILE_TEST_IS_DIR);
if (exists)
- list = g_list_prepend (list, g_strdup (dir->str));
+ {
+ GList *dup;
+
+ /* check for duplicate entries, see bug #784502 */
+ for (dup = list; dup; dup = g_list_next (dup))
+ {
+ if (! strcmp (dir->str, dup->data))
+ break;
+ }
+
+ /* only add to the list if it's not a duplicate */
+ if (! dup)
+ list = g_list_prepend (list, g_strdup (dir->str));
+ }
else if (check_failed)
- fail_list = g_list_prepend (fail_list, g_strdup (dir->str));
+ {
+ fail_list = g_list_prepend (fail_list, g_strdup (dir->str));
+ }
g_string_free (dir, TRUE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]