[gimp] app: restore operation src node in gimp_gegl_apply_[cached_]operation()



commit 73d7a81a4dc0176a6cf70d70870bcda2092c9c1a
Author: Ell <ell_se yahoo com>
Date:   Tue Dec 5 13:34:43 2017 -0500

    app: restore operation src node in gimp_gegl_apply_[cached_]operation()
    
    When merging a drawable filter, we call
    gimp_gegl_apply_cached_operation() on a node that's part of the
    drawable's filter stack graph.  The function rewires the node's
    input, and doesn't restore its original input connection before
    returning, leaving the graph in an inconsistent state.  Currently,
    this doesn't matter, since we remove the filter right after that,
    but the next commit expects the filter stack graph to remain
    consistent.
    
    Remember the original source node of "operation" in
    gimp_gegl_apply_cached_operation(), and restore it upon exit, to
    fix that.

 app/gegl/gimp-gegl-apply-operation.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index 6c524ab..48c283d 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -74,11 +74,12 @@ gimp_gegl_apply_cached_operation (GeglBuffer          *src_buffer,
 {
   GeglNode      *gegl;
   GeglNode      *dest_node;
+  GeglNode      *operation_src_node = NULL;
   GeglRectangle  rect = { 0, };
-  GeglProcessor *processor        = NULL;
-  gboolean       progress_started = FALSE;
+  GeglProcessor *processor          = NULL;
+  gboolean       progress_started   = FALSE;
   gdouble        value;
-  gboolean       cancel           = FALSE;
+  gboolean       cancel             = FALSE;
 
   g_return_val_if_fail (src_buffer == NULL || GEGL_IS_BUFFER (src_buffer), FALSE);
   g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
@@ -122,6 +123,8 @@ gimp_gegl_apply_cached_operation (GeglBuffer          *src_buffer,
 
       g_object_unref (src_buffer);
 
+      operation_src_node = gegl_node_get_producer (operation, "input", NULL);
+
       gegl_node_connect_to (src_node,  "output",
                             operation, "input");
     }
@@ -257,6 +260,12 @@ gimp_gegl_apply_cached_operation (GeglBuffer          *src_buffer,
 
   g_object_unref (gegl);
 
+  if (operation_src_node)
+    {
+      gegl_node_connect_to (operation_src_node, "output",
+                            operation,          "input");
+    }
+
   if (progress_started)
     {
       gimp_progress_end (progress);


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