[gegl] buffer-source: split invalidation during buffer change into two parts



commit 2dd72b51aad52c31caeb37f88b962410e8bde5c1
Author: Ell <ell_se yahoo com>
Date:   Mon May 15 16:56:53 2017 -0400

    buffer-source: split invalidation during buffer change into two parts
    
    When changing the buffer, call buffer_changed() on the old/new buffer
    before/after updating the op's buffer property, respectively, so that
    code executed as a result of the invalidtion sees the op while it
    corresponds to the right buffer.

 operations/common/buffer-source.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/operations/common/buffer-source.c b/operations/common/buffer-source.c
index 6694244..778f526 100644
--- a/operations/common/buffer-source.c
+++ b/operations/common/buffer-source.c
@@ -95,6 +95,11 @@ my_set_property (GObject      *object,
   Priv           *p         = get_priv (o);
   GeglBuffer     *buffer    = NULL;
 
+  /* we split buffer replacement into two parts -- before and after calling
+   * set_property() to update o->buffer -- so that code executed as a result
+   * of the invalidation performed by buffer_changed() sees the op with the
+   * right buffer.
+   */
   switch (property_id)
     {
     case PROP_buffer:
@@ -109,7 +114,20 @@ my_set_property (GObject      *object,
                           gegl_buffer_get_extent (GEGL_BUFFER (o->buffer)),
                           operation);
         }
+      break;
+
+    default:
+      break;
+  }
 
+  /* The set_property provided by the chant system does the storing
+   * and reffing/unreffing of the input properties
+   */
+  set_property (object, property_id, value, pspec);
+
+  switch (property_id)
+    {
+    case PROP_buffer:
       buffer = g_value_get_object (value);
 
       if (buffer)
@@ -127,11 +145,6 @@ my_set_property (GObject      *object,
     default:
       break;
   }
-
-  /* The set_property provided by the chant system does the storing
-   * and reffing/unreffing of the input properties
-   */
-  set_property (object, property_id, value, pspec);
 }
 
 static gboolean


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