We crash on recursive Use
The attached SVG crashes 2.42 and master.
This is because in structure.rs
, NodeUse::draw()
:
let acquired = draw_ctx.get_acquired_node(link.as_ref().unwrap()); // 1
let child = if let Some(acquired) = acquired { // 2
acquired.get()
} else {
return;
};
// 3
(1) acquires the node.
(2) moves the AcquiredNode
into the Some(acquired)
and drops it - this causes the node to be released.
(3) Thus we reach (3), and child
is not in the acquired nodes list anymore.
If I use if let Some(ref acquired) = ...
instead, the AcquiredNode
doesn't get dropped and we catch recursion in the attached SVG properly. However, this breaks the 761175-recursive-masks.svg
test.
It looks like we need different "acquisition contexts" for nodes: acquired for drawing, or masking, or clipping (or filtering?). One can acquire a node for drawing-but-not-clipping, and re-acquire it for drawing-while-clipping. But one cannot acquire a node twice for the same purpose.