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.
This commit is contained in:
Michael Natterer 2017-07-08 12:50:37 +02:00
parent 5ff921853a
commit 8294ca9d21
1 changed files with 17 additions and 2 deletions

View File

@ -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);
}