[gimp] Bug 722487: Something in the attached .gimp-2.8 directory makes...



commit 26738b9ff3491724c29d391bc4eb9b0bfcf2f05e
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Mon May 5 08:23:02 2014 +0200

    Bug 722487: Something in the attached .gimp-2.8 directory makes...
    
    GIMP fail on start
    
    Make gimp_tool_preset_load() robust against completely failed
    deserializing.

 app/core/gimpdatafactory.c     |    4 ++++
 app/core/gimptoolpreset-load.c |   14 +++++++++++++-
 po/POTFILES.in                 |    1 +
 3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c
index 52b338b..5851565 100644
--- a/app/core/gimpdatafactory.c
+++ b/app/core/gimpdatafactory.c
@@ -940,6 +940,10 @@ gimp_data_factory_load_data (const GimpDatafileData *file_data,
       g_list_free (data_list);
     }
 
+  /*  not else { ... } because loader->load_func() can return a list
+   *  of data objects *and* an error message if loading failed after
+   *  something was already loaded
+   */
   if (G_UNLIKELY (error))
     {
       gimp_message (factory->priv->gimp, NULL, GIMP_MESSAGE_ERROR,
diff --git a/app/core/gimptoolpreset-load.c b/app/core/gimptoolpreset-load.c
index 606f638..69f2291 100644
--- a/app/core/gimptoolpreset-load.c
+++ b/app/core/gimptoolpreset-load.c
@@ -20,6 +20,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gegl.h>
 
+#include "libgimpbase/gimpbase.h"
 #include "libgimpconfig/gimpconfig.h"
 
 #include "core-types.h"
@@ -28,6 +29,8 @@
 #include "gimptoolpreset.h"
 #include "gimptoolpreset-load.h"
 
+#include "gimp-intl.h"
+
 
 GList *
 gimp_tool_preset_load (GimpContext  *context,
@@ -49,7 +52,16 @@ gimp_tool_preset_load (GimpContext  *context,
                                     filename,
                                     NULL, error))
     {
-      return g_list_prepend (NULL, tool_preset);
+      if (GIMP_IS_CONTEXT (tool_preset->tool_options))
+        {
+          return g_list_prepend (NULL, tool_preset);
+        }
+      else
+        {
+          g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
+                       _("Error while parsing '%s'"),
+                       gimp_filename_to_utf8 (filename));
+        }
     }
 
   g_object_unref (tool_preset);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6e15e07..8f6b339 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -163,6 +163,7 @@ app/core/gimppdbprogress.c
 app/core/gimpprogress.c
 app/core/gimpselection.c
 app/core/gimpstrokeoptions.c
+app/core/gimptoolpreset-load.c
 app/core/gimp-tags.c
 app/core/gimptemplate.c
 app/core/gimptooloptions.c


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