From ac919dafb38520cbc2fc9168fb041bda0f17337c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 28 Jan 2017 01:28:38 +0100 Subject: -fix issue about memory management. --- node/keepdiceexecnode.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'node/keepdiceexecnode.cpp') diff --git a/node/keepdiceexecnode.cpp b/node/keepdiceexecnode.cpp index ab961af..d36abec 100644 --- a/node/keepdiceexecnode.cpp +++ b/node/keepdiceexecnode.cpp @@ -29,7 +29,10 @@ KeepDiceExecNode::KeepDiceExecNode() { m_result = m_diceResult; } +KeepDiceExecNode::~KeepDiceExecNode() +{ +} void KeepDiceExecNode::run(ExecutionNode* previous) { m_previousNode = previous; @@ -42,7 +45,20 @@ void KeepDiceExecNode::run(ExecutionNode* previous) if(NULL!=previousDiceResult) { QList diceList=previousDiceResult->getResultList(); - QList diceList2 = diceList.mid(0,m_numberOfDice); + + QList diceList3= diceList.mid(0,m_numberOfDice); + QList diceList2; + + foreach(Die* die,diceList3) + { + Die* tmpdie = new Die(); + *tmpdie=*die; + diceList2.append(tmpdie); + die->displayed(); + } + + + if(m_numberOfDice > diceList.size()) { m_errors.insert(TOO_MANY_DICE,QObject::tr(" You ask to keep %1 dice but the result only has %2").arg(m_numberOfDice).arg(diceList.size())); -- cgit v1.2.3-70-g09d2