[gegl] gegl-chain: make parser a bit more resilient



commit 0e8dccec01ade18b8dddf6d3ba9928307ea15d5d
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Apr 14 16:49:57 2016 +0200

    gegl-chain: make parser a bit more resilient

 gegl/gegl-serialize.c |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index 21c3bef..1d1c38c 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -165,14 +165,19 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
           else
           {
             unsigned int n_props = 0;
-            GParamSpec **pspecs;
             int i;
-
-            pspecs = gegl_operation_list_properties (level_op[level], &n_props);
-            for (i = 0; i < n_props; i++)
+            if (level_op[level])
             {
-              if (!strcmp (pspecs[i]->name, key))
-                target_type = pspecs[i]->value_type;
+            GParamSpec **pspecs;
+              pspecs = gegl_operation_list_properties (level_op[level], &n_props);
+              for (i = 0; i < n_props; i++)
+              {
+                if (!strcmp (pspecs[i]->name, key))
+                {
+                  target_type = pspecs[i]->value_type;
+                  break;
+                }
+              }
             }
 
         if (match[1] == '{')
@@ -218,11 +223,17 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
         else
         if (target_type == 0)
             {
-              if (error && gegl_has_operation (level_op[level]))
+              if (error && level_op[level] && gegl_has_operation (level_op[level]))
               {
+            unsigned int n_props = 0;
+            int i;
+            GParamSpec **pspecs;
+
                 GString *str = g_string_new ("");
                 g_string_append_printf (str, "%s has no %s property, but has ",
                   level_op[level], key);
+                pspecs = gegl_operation_list_properties (level_op[level], &n_props);
+
                 for (i = 0; i < n_props; i++)
                 {
                   g_string_append_printf (str, "'%s', ", pspecs[i]->name);
@@ -367,6 +378,13 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
       arg++;
     }
 
+
+  while (level > 0)
+  {
+    level--;
+    gegl_node_connect_to (iter[level+1], "output", iter[level], level_pad[level]);
+  }
+
   if (prop)
   {
     g_free (prop);


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