[git] GPA - branch, master, updated. gpa-0.9.10-8-gee3ec98

by Andre Heinecke cvs at cvs.gnupg.org
Sun May 14 14:45:09 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Assistant".

The branch, master has been updated
       via  ee3ec98dba5a8c98e9ca9737da633d0767d54214 (commit)
      from  2dae64a65080c52a731d98a905a447de1428cc7c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ee3ec98dba5a8c98e9ca9737da633d0767d54214
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Sun May 14 14:39:57 2017 +0200

    Fix crash on filename conversion error
    
    * src/fileman.c (add_file): Handle conversion errors.
    
    --
    If g_filename_to_utf8 fails we now fall back to g_locale_to_utf8.
    If this still does not work we fall back to g_filename_display_name
    which replaces unconvertibale strings by question marks or unicode
    markup.
    Previously NULL pointer would be inserted as filenames, leading
    to crashes later on.
    
    This is especially important for windows where D&D files came
    in System encoding as well as "Double clicked" or "Open With" files.
    On windows filename_to_utf8 always assumes that the input is already
    UTF-8, because it's stupid. (or because the GTK File Dialog returns
    UTF-8 filenames) so the fallback to locale is especially important
    here.
    
    GnuPG-Bug-ID: T2185

diff --git a/src/fileman.c b/src/fileman.c
index 10824d4..cb0b67f 100644
--- a/src/fileman.c
+++ b/src/fileman.c
@@ -217,7 +217,22 @@ add_file (GpaFileManager *fileman, const gchar *filename)
   gchar *filename_utf8;
 
   /* The tree contains filenames in the UTF-8 encoding.  */
-  filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL),
+  filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+  /* Try to convert from the current locale as fallback. This is important
+     for windows where g_filename_to_utf8 does not take locale into account
+     because the filedialogs already convert to utf8. */
+  if (!filename_utf8)
+    {
+      filename_utf8 = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+    }
+
+  /* Last fallback is guranteed to never be NULL so in doubt we can still fail
+     later showing a filename that can't be found to the user etc.*/
+  if (!filename_utf8)
+    {
+      filename_utf8 = g_filename_display_name (filename);
+    }
 
   store = GTK_LIST_STORE (gtk_tree_view_get_model
                           (GTK_TREE_VIEW (fileman->list_files)));

-----------------------------------------------------------------------

Summary of changes:
 src/fileman.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
The GNU Privacy Assistant
http://git.gnupg.org




More information about the Gnupg-commits mailing list