Value weak_ptr for enclosing

This commit is contained in:
Michael Davidsaver
2020-03-05 14:11:36 -08:00
parent eb13ac276a
commit 85d4aa1f03
2 changed files with 7 additions and 7 deletions
+5 -4
View File
@@ -70,7 +70,7 @@ Value::Value(const std::shared_ptr<const impl::FieldDesc>& desc, Value& parent)
:Value(desc)
{
// TODO ref. loop detection
store->top->enclosing = parent;
store->top->enclosing = parent.store;
}
Value::~Value() {}
@@ -243,9 +243,10 @@ void Value::mark(bool v)
return;
auto top = store->top;
while(top && top->enclosing) {
top->enclosing.mark();
top = top->enclosing.store->top;
std::shared_ptr<FieldStorage> enc;
while(top && (enc=top->enclosing.lock())) {
enc->valid = true;
top = enc->top;
}
}