evince r2931 - in trunk: . libdocument



Author: carlosgc
Date: Wed Feb 27 17:58:26 2008
New Revision: 2931
URL: http://svn.gnome.org/viewvc/evince?rev=2931&view=rev

Log:
2008-02-27  Carlos Garcia Campos  <carlosgc gnome org>

	* libdocument/ev-document-factory.c: (get_mime_type_from_uri):

	Duplicate mime_type string before freeing it so that it doesn't
	always fail when getting mime type from uri. Fixes bug #518874.


Modified:
   trunk/ChangeLog
   trunk/libdocument/ev-document-factory.c

Modified: trunk/libdocument/ev-document-factory.c
==============================================================================
--- trunk/libdocument/ev-document-factory.c	(original)
+++ trunk/libdocument/ev-document-factory.c	Wed Feb 27 17:58:26 2008
@@ -106,9 +106,9 @@
 static gchar *
 get_mime_type_from_uri (const gchar *uri)
 {
-	GFile       *file;
-	GFileInfo   *file_info;
-	const gchar *mime_type;
+	GFile     *file;
+	GFileInfo *file_info;
+	gchar     *mime_type;
 
 	file = g_file_new_for_uri (uri);
 	file_info = g_file_query_info (file,
@@ -119,10 +119,10 @@
 	if (file_info == NULL)
 		return NULL;
 
-	mime_type = g_file_info_get_content_type (file_info);
+	mime_type = g_strdup (g_file_info_get_content_type (file_info));
 	g_object_unref (file_info);
 
-	return g_strdup (mime_type);
+	return mime_type;
 }
 
 static gchar *
@@ -169,7 +169,7 @@
 	mime_type = slow ?
 		get_mime_type_from_data (uri) :
 		get_mime_type_from_uri (uri);
-	
+
 	if (mime_type == NULL) {
 		g_set_error (error,
 			     EV_DOCUMENT_ERROR,	



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