[eog/gnome-2-26] Bug 580600 – eog crashes on drag&drop a directory from places menu



commit 276d690c4048f4c36e54e8c86e7f55fb77ac1ee4
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 0d18ab5..9681c9b 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]