if (isSolved)
{
- Node s = sz.substitute(d_sol);
+ // As it traverses sz, substitute populates its input cache with TNodes
+ // that are not preserved by this module and maybe destroyed after the
+ // method call. To avoid referencing those unsafe TNodes throughout this
+ // module, we pass a iterators of d_sol instead.
+ Node s = sz.substitute(d_sol.cbegin(), d_sol.cend());
markSolved(k, s);
}
else
{
// then it is completely solved and can be used as a solution of its
// corresponding obligation
- Node parentSol = parent.substitute(d_sol);
+ // pass iterators of d_sol to avoid populating it with unsafe TNodes
+ Node parentSol = parent.substitute(d_sol.cbegin(), d_sol.cend());
Node parentOb = d_parentOb[parent];
// proceed only if parent obligation is not already solved
if (d_sol[parentOb].isNull())