]> www.fi.muni.cz Git - evince.git/commitdiff
Duplicate mime_type string before freeing it so that it doesn't always
authorCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 27 Feb 2008 17:58:26 +0000 (17:58 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Wed, 27 Feb 2008 17:58:26 +0000 (17:58 +0000)
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.

svn path=/trunk/; revision=2931

ChangeLog
libdocument/ev-document-factory.c

index 41c94bb6216d79b303b6bd01a3b18d634dab197a..1517b4b1d7537514e750739a78660a7d313dedf0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
+       
 2008-02-27  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * shell/ev-view.c: (ev_view_form_field_choice_changed):
index 5b2473f5e1b2e5e55e66ff3b381b2e9e0eeb7a3d..962f42a604250c39857e9df399ed0a29ab4cba36 100644 (file)
@@ -106,9 +106,9 @@ get_compression_from_mime_type (const gchar *mime_type)
 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 @@ get_mime_type_from_uri (const gchar *uri)
        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 @@ get_document_from_uri (const char        *uri,
        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,