[eog] Bug 580600 – eog crashes on drag&drop a directory from places menu



commit 771d1a4b248d03318cafb2e03281624b1a961240
Author: Felix Riemann <friemann svn gnome org>
Date:   Tue Apr 28 18:03:37 2009 +0200

    Bug 580600 â?? eog crashes on drag&drop a directory from places menu
    
    Use the function provided to GLib to extract the uris from a uri list
    string instead. This fixes crashes with malformed uri lists as the GLib
    function is less picky especially about the delimiters.
---
 ChangeLog      |    7 +++++++
 src/eog-util.c |   22 ++++++++--------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 28f6761..713ccf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-28  Felix Riemann  <friemann svn gnome org>
+
+	* src/eog-util.c (eog_util_parse_uri_string_list_to_file_list):
+	Use function provided by GLib to extract the uris from the uri list
+	instead of doing it ourselves. Fixes crashes on malformed uri lists
+	as it is less picky. Fixes bug #580600.
+
 2009-04-26  Felix Riemann  <friemann svn gnome org>
 
 	* src/eog-application.c: Improve API documentation.
diff --git a/src/eog-util.c b/src/eog-util.c
index f300951..62d4087 100644
--- a/src/eog-util.c
+++ b/src/eog-util.c
@@ -124,24 +124,18 @@ GSList*
 eog_util_parse_uri_string_list_to_file_list (const gchar *uri_list)
 {
 	GSList* file_list = NULL;
-	const char *start, *end;
-	char *uri;
+	gsize i = 0;
+	gchar **uris;
 
-	start = uri_list;
-	end = strchr (uri_list, '\r');
-	uri = g_strndup (start, end - start);
-	file_list = g_slist_append (file_list, g_file_new_for_uri (uri));
-	g_free (uri);
+	uris = g_uri_list_extract_uris (uri_list);
 
-	while (strlen (end) > 2)
-	{
-		start = (end + 2);
-		end = strchr (start, '\r');
-		uri = g_strndup (start, end - start);
-		file_list = g_slist_append (file_list, g_file_new_for_uri (uri));
-		g_free (uri);
+	while (uris[i] != NULL) {
+		file_list = g_slist_append (file_list, g_file_new_for_uri (uris[i]));
+		i++;
 	}
 
+	g_strfreev (uris);
+
 	return file_list;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]