[librsvg: 5/9] NodeUse: don't drop the acquired node immediately
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 5/9] NodeUse: don't drop the acquired node immediately
- Date: Tue, 15 Oct 2019 16:21:19 +0000 (UTC)
commit ddbfb471d8d7e1519bffaadcd12e0672f43f227b
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Oct 15 09:33:56 2019 -0500
NodeUse: don't drop the acquired node immediately
rsvg_internals/src/structure.rs | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index efce30d0..49ea396d 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -313,13 +313,8 @@ impl NodeTrait for NodeUse {
let link = self.link.as_ref().unwrap();
- let child = match draw_ctx.acquire_node(link, &[]) {
- Ok(acquired) => {
- // Here we clone the acquired child, so that we can drop the AcquiredNode as
- // early as possible. This is so that the child's drawing method will be able
- // to re-acquire the child for other purposes.
- acquired.get().clone()
- }
+ let acquired = match draw_ctx.acquire_node(link, &[]) {
+ Ok(acquired) => acquired,
Err(AcquireError::CircularReference(_)) => {
// FIXME: add a fragment or node id to this:
@@ -339,7 +334,9 @@ impl NodeTrait for NodeUse {
}
};
- if node.ancestors().any(|ancestor| ancestor == child) {
+ let child = acquired.get();
+
+ if node.ancestors().any(|ancestor| ancestor == *child) {
// or, if we're <use>'ing ourselves
return Err(RenderingError::CircularReference);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]