Fix parse-time RecordVal tracking containing duplicates

The same RecordVal was unintentionally being added to the list within
a loop over its fields instead of just once per ctor.
This commit is contained in:
Jon Siwek 2019-05-23 10:49:38 -07:00
parent 0f2e778216
commit 8d6dbc2d46
3 changed files with 11 additions and 7 deletions

View file

@ -2887,6 +2887,12 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : MutableVal(t)
int n = record_type->NumFields();
val_list* vl = val.val_list_val = new val_list(n);
if ( is_parsing )
{
parse_time_records.emplace_back(this);
Ref();
}
if ( ! init_fields )
return;
@ -2928,12 +2934,6 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : MutableVal(t)
vl->append(def ? def->Ref() : 0);
Unref(def);
if ( is_parsing )
{
parse_time_records.emplace_back(this);
Ref();
}
}
}