Dragged and dropped paths from xfe aren't escaped like paths from a gtk app. A folder named 'test # one' for example causes g_filename_from_uri to fail and return NULL, which then causes a SIGSEGV in path_to_utf8.
This patch fixes the crash by checking for failed conversions. If conversion failed due to a bad URI, it will manually escape the URI and try converting it again. --- src/uri_utils.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/uri_utils.c b/src/uri_utils.c index a60e492..127efbd 100644 --- a/src/uri_utils.c +++ b/src/uri_utils.c @@ -66,10 +66,36 @@ GList *uri_pathlist_from_uris(gchar **uris) { GList *list = NULL; guint i = 0; + GError *error = NULL; while (uris[i]) { - gchar *local_path = g_filename_from_uri(uris[i], NULL, NULL); + gchar *local_path = g_filename_from_uri(uris[i], NULL, &error); + if (error) + { + DEBUG_1("g_filename_from_uri failed on uri \"%s\"", uris[i]); + DEBUG_1(" error %d: %s", error->code, error->message); + if (error->code == G_CONVERT_ERROR_BAD_URI) + { + GError *retry_error = NULL; + gchar *escaped = g_uri_escape_string(uris[i], ":/", TRUE); + local_path = g_filename_from_uri(escaped, NULL, &retry_error); + if(retry_error) + { + DEBUG_1("manually escaped uri \"%s\" also failed g_filename_from_uri", escaped); + DEBUG_1(" error %d: %s", retry_error->code, retry_error->message); + g_error_free(retry_error); + } + g_free(escaped); + } + g_error_free(error); + error = NULL; + if (!local_path) + { + i++; + continue; + } + } gchar *path = path_to_utf8(local_path); g_free(local_path); list = g_list_prepend(list, path); -- 2.8.1 ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Geeqie-devel mailing list Geeqie-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geeqie-devel