[gimp/gimp-2-10] pdb: don't pass nodes with parents to gimp_drawable_apply_operation()



commit afdd57313627fa3b367f62ead7b7b15fc53e644e
Author: Michael Natterer <mitch gimp org>
Date:   Mon Aug 12 19:41:48 2019 +0200

    pdb: don't pass nodes with parents to gimp_drawable_apply_operation()
    
    (cherry picked from commit 8222d3ffadb50ec62cb1b5db79b1ebe1828cd9d4)

 app/pdb/plug-in-compat-cmds.c | 20 +++++++-------------
 pdb/groups/plug_in_compat.pdb | 20 +++++++-------------
 2 files changed, 14 insertions(+), 26 deletions(-)
---
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index e228e0a7ec..40619df58c 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -212,13 +212,10 @@ bump_map (GimpDrawable *drawable,
                                  GIMP_PDB_ITEM_CONTENT, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GeglNode *gegl;
       GeglNode *node;
       GeglNode *src_node;
 
-      gegl = gegl_node_new ();
-
-      node = gegl_node_new_child (gegl,
+      node = gegl_node_new_child (NULL,
                                   "operation", "gegl:bump-map",
                                   "tiled",      tiled,
                                   "type",       type,
@@ -233,14 +230,14 @@ bump_map (GimpDrawable *drawable,
                                   "ambient",    ambient,
                                   NULL);
 
-      src_node = create_buffer_source_node (gegl, bump_map);
+      src_node = create_buffer_source_node (node, bump_map);
 
       gegl_node_connect_to (src_node, "output", node, "aux");
 
       gimp_drawable_apply_operation (drawable, progress,
                                      C_("undo-type", "Bump Map"),
                                      node);
-      g_object_unref (gegl);
+      g_object_unref (node);
 
       return TRUE;
     }
@@ -267,7 +264,6 @@ displace (GimpDrawable  *drawable,
     {
       if (do_x || do_y)
         {
-          GeglNode *gegl;
           GeglNode *node;
           GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
 
@@ -284,9 +280,7 @@ displace (GimpDrawable  *drawable,
                 break;
             }
 
-          gegl = gegl_node_new ();
-
-          node = gegl_node_new_child (gegl,
+          node = gegl_node_new_child (NULL,
                                       "operation",     "gegl:displace",
                                       "displace_mode", displace_mode,
                                       "sampler_type",  GEGL_SAMPLER_CUBIC,
@@ -298,21 +292,21 @@ displace (GimpDrawable  *drawable,
           if (do_x)
             {
               GeglNode *src_node;
-              src_node = create_buffer_source_node (gegl, displace_map_x);
+              src_node = create_buffer_source_node (node, displace_map_x);
               gegl_node_connect_to (src_node, "output", node, "aux");
             }
 
           if (do_y)
             {
               GeglNode *src_node;
-              src_node = create_buffer_source_node (gegl, displace_map_y);
+              src_node = create_buffer_source_node (node, displace_map_y);
               gegl_node_connect_to (src_node, "output", node, "aux2");
             }
 
           gimp_drawable_apply_operation (drawable, progress,
                                          C_("undo-type", "Displace"),
                                          node);
-          g_object_unref (gegl);
+          g_object_unref (node);
         }
 
       return TRUE;
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index ec21734e6a..5389c61c85 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -5174,13 +5174,10 @@ bump_map (GimpDrawable *drawable,
                                  GIMP_PDB_ITEM_CONTENT, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GeglNode *gegl;
       GeglNode *node;
       GeglNode *src_node;
 
-      gegl = gegl_node_new ();
-
-      node = gegl_node_new_child (gegl,
+      node = gegl_node_new_child (NULL,
                                   "operation", "gegl:bump-map",
                                   "tiled",      tiled,
                                   "type",       type,
@@ -5195,14 +5192,14 @@ bump_map (GimpDrawable *drawable,
                                   "ambient",    ambient,
                                   NULL);
 
-      src_node = create_buffer_source_node (gegl, bump_map);
+      src_node = create_buffer_source_node (node, bump_map);
 
       gegl_node_connect_to (src_node, "output", node, "aux");
 
       gimp_drawable_apply_operation (drawable, progress,
                                      C_("undo-type", "Bump Map"),
                                      node);
-      g_object_unref (gegl);
+      g_object_unref (node);
 
       return TRUE;
     }
@@ -5229,7 +5226,6 @@ displace (GimpDrawable  *drawable,
     {
       if (do_x || do_y)
         {
-          GeglNode *gegl;
           GeglNode *node;
           GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
 
@@ -5246,9 +5242,7 @@ displace (GimpDrawable  *drawable,
                 break;
             }
 
-          gegl = gegl_node_new ();
-
-          node = gegl_node_new_child (gegl,
+          node = gegl_node_new_child (NULL,
                                       "operation",     "gegl:displace",
                                       "displace_mode", displace_mode,
                                       "sampler_type",  GEGL_SAMPLER_CUBIC,
@@ -5260,21 +5254,21 @@ displace (GimpDrawable  *drawable,
           if (do_x)
             {
               GeglNode *src_node;
-              src_node = create_buffer_source_node (gegl, displace_map_x);
+              src_node = create_buffer_source_node (node, displace_map_x);
               gegl_node_connect_to (src_node, "output", node, "aux");
             }
 
           if (do_y)
             {
               GeglNode *src_node;
-              src_node = create_buffer_source_node (gegl, displace_map_y);
+              src_node = create_buffer_source_node (node, displace_map_y);
               gegl_node_connect_to (src_node, "output", node, "aux2");
             }
 
           gimp_drawable_apply_operation (drawable, progress,
                                          C_("undo-type", "Displace"),
                                          node);
-          g_object_unref (gegl);
+          g_object_unref (node);
         }
 
       return TRUE;


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