[gimp] libgimp: only add the generic metadata aux arguments once.



commit b78eb953f2b9cf3e8617b8cb6808b9820674ef00
Author: Jehan <jehan girinstud io>
Date:   Sun Apr 4 01:23:48 2021 +0200

    libgimp: only add the generic metadata aux arguments once.
    
    There was at least a case when gimp_procedure_create_config() was called
    twice, hence so was gimp_save_procedure_add_metadata() when a plug-in
    was run.
    It was happening when calling a procedure with less arguments than the
    procedure had. In such case, gimp_procedure_run() would create a config
    to fill it with defaults.
    
    Fixes warnings such as:
    
    > LibGimp-WARNING **: 01:29:57.044: Auxiliary argument with name 'save-exif' already exists on procedure 
'file-png-save'

 libgimp/gimpsaveprocedure.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/libgimp/gimpsaveprocedure.c b/libgimp/gimpsaveprocedure.c
index 39414f5a1f..69346bec00 100644
--- a/libgimp/gimpsaveprocedure.c
+++ b/libgimp/gimpsaveprocedure.c
@@ -396,7 +396,11 @@ gimp_save_procedure_create_config (GimpProcedure  *procedure,
 static void
 gimp_save_procedure_add_metadata (GimpSaveProcedure *save_procedure)
 {
-  GimpProcedure *procedure = GIMP_PROCEDURE (save_procedure);
+  GimpProcedure   *procedure = GIMP_PROCEDURE (save_procedure);
+  static gboolean  ran_once = FALSE;
+
+  if (ran_once)
+    return;
 
   if (save_procedure->priv->supports_exif)
     GIMP_PROC_AUX_ARG_BOOLEAN (procedure, "save-exif",
@@ -445,6 +449,7 @@ gimp_save_procedure_add_metadata (GimpSaveProcedure *save_procedure)
                                         GIMP_ARGUMENT_SYNC_PARASITE);
     }
 
+  ran_once = TRUE;
 }
 
 


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