From 741b7577c14911fed71b6d52d8d90e88ef2e05ef Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sun, 14 Mar 2010 11:58:07 +0000 Subject: Merge r20344 & r20346. --- src/libexpr/parser.y | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libexpr/parser.y') diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index c4afb72eacd5..8706ce025477 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -85,6 +85,10 @@ static Expr fixAttrs(bool recursive, ATermList as) { Tree attrs; + /* This ATermMap is needed to ensure that the `leaf' fields in the + Tree nodes are not garbage collected. */ + ATermMap gcRoots; + for (ATermIterator i(as); i; ++i) { ATermList names, attrPath; Expr src, e; ATerm name, pos; @@ -95,7 +99,9 @@ static Expr fixAttrs(bool recursive, ATermList as) throw ParseError(format("duplicate definition of attribute `%1%' at %2%") % showAttrPath(ATmakeList1(*j)) % showPos(pos)); Tree & t(attrs.children[*j]); - t.leaf = fromScope ? makeVar(*j) : makeSelect(src, *j); + Expr leaf = fromScope ? makeVar(*j) : makeSelect(src, *j); + gcRoots.set(leaf, leaf); + t.leaf = leaf; t.pos = pos; if (recursive && fromScope) t.recursive = false; } -- cgit 1.4.1