]> www.fi.muni.cz Git - evince.git/commitdiff
[comics] Fixes handling of the tmp folder
authorJuanjo Marín <juanj.marin@juntadeandalucia.es>
Sun, 17 May 2009 13:22:31 +0000 (17:22 +0400)
committerNickolay V. Shmyrev <nshmyrev@yandex.ru>
Sun, 17 May 2009 13:22:31 +0000 (17:22 +0400)
Uses common function for a temporary file creation. Fixes crash in
GNOME bug #582108.

backend/comics/comics-document.c
libdocument/ev-file-helpers.c
libdocument/ev-file-helpers.h

index 29a1581d143fede0359cccd8efd7fa17ee7af604..ca154710f41729653b6d69964fa5f4f219c7d92e 100644 (file)
@@ -183,7 +183,7 @@ static gboolean
 comics_generate_command_lines (ComicsDocument *comics_document, 
                               GError         **error)
 {
-       gchar *quoted_file, *checksum;
+       gchar *quoted_file;
        ComicBookDecompressType type;
        
        type = comics_document->command_usage;
@@ -198,19 +198,13 @@ comics_generate_command_lines (ComicsDocument *comics_document,
                                             quoted_file);
        comics_document->regex_arg = command_usage_def[type].regex_arg;
        if (command_usage_def[type].decompress_tmp) {
-               checksum = 
-                       g_compute_checksum_for_string (G_CHECKSUM_MD5, 
-                                                      comics_document->archive,
-                                                      -1);
-               comics_document->dir = g_build_filename (ev_tmp_dir (), 
-                                                        checksum, NULL);
+               comics_document->dir = ev_tmp_directory (NULL); 
                comics_document->decompress_tmp = 
                        g_strdup_printf (command_usage_def[type].decompress_tmp, 
                                         comics_document->selected_command, 
                                         quoted_file, 
                                         comics_document->dir);
                g_free (quoted_file);
-               g_free (checksum);
                /* unrar-free can't create directories so we do it on its 
                 * behalf */
                if (type == GNAUNRAR) {
index 67e884a4ee4e47959c135dc3bfb0a4dae7f10ba8..3da4a59832d5031bedac8c19a00c3ef62fc4686b 100644 (file)
@@ -122,6 +122,12 @@ ev_tmp_filename (const gchar *prefix)
        return filename;
 }
 
+gchar * 
+ev_tmp_directory (const gchar *prefix) 
+{
+       return ev_tmp_filename (prefix ? prefix : "directory");
+}
+
 /* Remove a local temp file created by evince */
 void
 ev_tmp_filename_unlink (const gchar *filename)
index adec69c35b23b4d1004eedb5c801966bfd0840c1..47a5417149f915b25abde991052a30fe3a448e89 100644 (file)
@@ -47,6 +47,7 @@ gboolean     ev_dir_ensure_exists     (const gchar       *dir,
 
 GFile       *ev_tmp_file_get          (const gchar       *prefix);
 gchar       *ev_tmp_filename          (const char        *prefix);
+gchar       *ev_tmp_directory         (const char        *prefix);
 void         ev_tmp_filename_unlink   (const gchar       *filename);
 void         ev_tmp_file_unlink       (GFile             *file);
 void         ev_tmp_uri_unlink        (const gchar       *uri);