[librsvg/librsvg-2.46] AcquiredNode: store the stack as an Option.
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.46] AcquiredNode: store the stack as an Option.
- Date: Tue, 15 Oct 2019 16:47:43 +0000 (UTC)
commit 098f83df30470ca9437c19f203b6fc0af239ec89
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Oct 15 08:35:54 2019 -0500
AcquiredNode: store the stack as an Option.
We'll move to a model where we only push nodes that are only
accessible by reference, not all nodes that are acquired.
rsvg_internals/src/drawing_ctx.rs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index a6ccc824..cc22d43e 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -1069,15 +1069,17 @@ impl From<RsvgRectangle> for cairo::Rectangle {
}
pub struct AcquiredNode {
- stack: Rc<RefCell<NodeStack>>,
+ stack: Option<Rc<RefCell<NodeStack>>>,
node: RsvgNode,
}
impl Drop for AcquiredNode {
fn drop(&mut self) {
- let mut stack = self.stack.borrow_mut();
- let last = stack.pop().unwrap();
- assert!(last == self.node);
+ if let Some(ref stack) = self.stack {
+ let mut stack = stack.borrow_mut();
+ let last = stack.pop().unwrap();
+ assert!(last == self.node);
+ }
}
}
@@ -1141,7 +1143,7 @@ impl AcquiredNodes {
} else {
self.node_stack.borrow_mut().push(&node);
let acquired = AcquiredNode {
- stack: self.node_stack.clone(),
+ stack: Some(self.node_stack.clone()),
node: node.clone()
};
Ok(acquired)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]