[librsvg] bgo#761175 - Allow masks to (re)use a node being referenced



commit 6feb907439f298c7c5f39c422bd9ab8edf6ce6c8
Author: Federico Mena Quintero <federico gnome org>
Date:   Sat Nov 11 04:52:09 2017 -0600

    bgo#761175 - Allow masks to (re)use a node being referenced
    
    If a <use> element acquires a node for drawing, then it needs to
    release the node before calling pop_discrete_layer().  Mask generation
    occurs in that function, and the mask may in turn reuse the referenced
    node.  If the node is still acquired at that time, the mask will not
    be able to use it.
    
    We also regenerate the test reference file; this seems to have changed
    due to the the changes to the mask's default bounds when NodeMask was
    ported to Rust.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761175

 rust/src/structure.rs                              |    5 +++--
 .../reftests/bugs/761175-recursive-masks-ref.png   |  Bin 513 -> 460 bytes
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/structure.rs b/rust/src/structure.rs
index 507a2a5..62f7c7f 100644
--- a/rust/src/structure.rs
+++ b/rust/src/structure.rs
@@ -296,6 +296,7 @@ impl NodeTrait for NodeUse {
             drawing_ctx::draw_node_from_stack (draw_ctx, boxed_child, 1);
             rsvg_node_unref (boxed_child);
 
+            drawing_ctx::release_node (draw_ctx, raw_child);
             drawing_ctx::pop_discrete_layer (draw_ctx);
         } else {
             child.with_impl (|symbol: &NodeSymbol| {
@@ -316,9 +317,9 @@ impl NodeTrait for NodeUse {
                                      drawing_ctx::state_pop(draw_ctx);
                                  });
             });
-        }
 
-        drawing_ctx::release_node (draw_ctx, raw_child);
+            drawing_ctx::release_node (draw_ctx, raw_child);
+        }
     }
 
     fn get_c_impl (&self) -> *const RsvgCNodeImpl {
diff --git a/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png 
b/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png
index aceb5d2..988c55e 100644
Binary files a/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png and 
b/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png differ


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