[gimp] Revert "libgimp, libgimpconfig: gimp_config_deserialize_file() should not…"



commit f4c7ea7e02a874c7973065e79933a2b2e43ef636
Author: Jehan <jehan girinstud io>
Date:   Thu Feb 10 22:03:36 2022 +0100

    Revert "libgimp, libgimpconfig: gimp_config_deserialize_file() should not…"
    
    This reverts commit 73c0ee8da7abd66b7d84fff8d585f875e359e2ed.
    
    Actually I was wrong, there was a bug in gimpconfig-deserialize.c. See
    coming commit.

 libgimp/gimpprocedureconfig.c    | 3 +--
 libgimpconfig/gimpconfig-iface.c | 3 +++
 libgimpconfig/gimpconfig-iface.h | 3 ---
 3 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/libgimp/gimpprocedureconfig.c b/libgimp/gimpprocedureconfig.c
index 71544cf5dd..3dbd8cbea8 100644
--- a/libgimp/gimpprocedureconfig.c
+++ b/libgimp/gimpprocedureconfig.c
@@ -981,8 +981,7 @@ gimp_procedure_config_load_last (GimpProcedureConfig  *config,
                                           file,
                                           NULL, error);
 
-  if (! success && error && *error &&
-      (*error)->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
+  if (! success && (*error)->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
     {
       g_clear_error (error);
     }
diff --git a/libgimpconfig/gimpconfig-iface.c b/libgimpconfig/gimpconfig-iface.c
index 65e83c4eca..51d5c97b56 100644
--- a/libgimpconfig/gimpconfig-iface.c
+++ b/libgimpconfig/gimpconfig-iface.c
@@ -494,6 +494,9 @@ gimp_config_deserialize_file (GimpConfig  *config,
 
   gimp_scanner_unref (scanner);
 
+  if (! success)
+    g_assert (error == NULL || *error != NULL);
+
   return success;
 }
 
diff --git a/libgimpconfig/gimpconfig-iface.h b/libgimpconfig/gimpconfig-iface.h
index ac3ad83b0f..605e999a1a 100644
--- a/libgimpconfig/gimpconfig-iface.h
+++ b/libgimpconfig/gimpconfig-iface.h
@@ -40,9 +40,6 @@ struct _GimpConfigInterface
   gboolean     (* serialize)            (GimpConfig       *config,
                                          GimpConfigWriter *writer,
                                          gpointer          data);
-  /* TODO: we should add a GError** parameter to the deserialize()
-   * method in order to be able to report errors.
-   */
   gboolean     (* deserialize)          (GimpConfig       *config,
                                          GScanner         *scanner,
                                          gint              nest_level,


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