[gimp/gimp-2-8] Bug 722400 - GIMP segfaults when trying to save a modified, newly created image



commit 073d70fa8cd1beffe5d0a39132ad694437b629bc
Author: Michael Natterer <mitch gimp org>
Date:   Sat Feb 8 10:18:29 2014 +0100

    Bug 722400 - GIMP segfaults when trying to save a modified, newly created image
    
    If for whatever reason making an uri from the documents folder fails,
    return the uri of the home directory.
    
    (cherry picked from commit aabd64e0701b96fbffd9dca2951e3bbe2292326a)

 app/widgets/gimpfiledialog.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c
index 95c8c41..7459b09 100644
--- a/app/widgets/gimpfiledialog.c
+++ b/app/widgets/gimpfiledialog.c
@@ -1149,13 +1149,24 @@ gimp_file_dialog_get_documents_uri (void)
   gchar *uri;
 
   /* Make sure it ends in '/' */
-  path = g_build_path ("/",
+  path = g_build_path (G_DIR_SEPARATOR_S,
                        g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS),
-                       "/",
+                       G_DIR_SEPARATOR_S,
                        NULL);
   uri = g_filename_to_uri (path, NULL, NULL);
   g_free (path);
 
+  /* Paranoia fallback, see bug #722400 */
+  if (! uri)
+    {
+      path = g_build_path (G_DIR_SEPARATOR_S,
+                           g_get_home_dir (),
+                           G_DIR_SEPARATOR_S,
+                           NULL);
+      uri = g_filename_to_uri (path, NULL, NULL);
+      g_free (path);
+    }
+
   return uri;
 }
 


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