From 6f0bdcf8dc8cbe2090c337aedb700571873b9a49 Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Fri, 17 May 2013 10:38:03 -0400 Subject: [PATCH] Fix destruction issue in GetValueCommand leading to crash. Thanks to David Cok for reporting this. --- src/expr/command.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/expr/command.cpp b/src/expr/command.cpp index 593f84ced..36336a959 100644 --- a/src/expr/command.cpp +++ b/src/expr/command.cpp @@ -795,17 +795,17 @@ const std::vector& GetValueCommand::getTerms() const throw() { void GetValueCommand::invoke(SmtEngine* smtEngine) throw() { try { - vector result; - NodeManager* nm = NodeManager::fromExprManager(smtEngine->getExprManager()); + vector result; + ExprManager* em = smtEngine->getExprManager(); + NodeManager* nm = NodeManager::fromExprManager(em); for(std::vector::const_iterator i = d_terms.begin(); i != d_terms.end(); ++i) { Assert(nm == NodeManager::fromExprManager((*i).getExprManager())); smt::SmtScope scope(smtEngine); Node request = Node::fromExpr(options::expandDefinitions() ? smtEngine->expandDefinitions(*i) : *i); Node value = Node::fromExpr(smtEngine->getValue(*i)); - result.push_back(nm->mkNode(kind::SEXPR, request, value)); + result.push_back(nm->mkNode(kind::SEXPR, request, value).toExpr()); } - Node n = nm->mkNode(kind::SEXPR, result); - d_result = nm->toExpr(n); + d_result = em->mkExpr(kind::SEXPR, result); d_commandStatus = CommandSuccess::instance(); } catch(exception& e) { d_commandStatus = new CommandFailure(e.what()); -- 2.30.2