diff options
| author | 2017-01-28 00:47:59 +0100 | |
|---|---|---|
| committer | 2017-01-28 00:47:59 +0100 | |
| commit | ba4f536cac97fd6acbe69fdb8d76bd7a1a026557 (patch) | |
| tree | 3188e83f65d4f1718c607dad061909061f730c57 /node | |
| parent | b82e546e0a7b9687282659dd1d60005eb2268fe0 (diff) | |
| download | OneRoll-ba4f536cac97fd6acbe69fdb8d76bd7a1a026557.tar.gz OneRoll-ba4f536cac97fd6acbe69fdb8d76bd7a1a026557.zip | |
-fix crash memory in sort result.
TODO: Optimization about the copy of die.
Perhaps using reference will be better.
Diffstat (limited to 'node')
| -rw-r--r-- | node/sortresult.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/node/sortresult.cpp b/node/sortresult.cpp index 8dee7d5..d864aa2 100644 --- a/node/sortresult.cpp +++ b/node/sortresult.cpp @@ -41,14 +41,18 @@ void SortResultNode::run(ExecutionNode* node) DiceResult* previousDiceResult = dynamic_cast<DiceResult*>(node->getResult()); m_diceResult->setPrevious(previousDiceResult); if(NULL!=previousDiceResult) - { + { QList<Die*> diceList=previousDiceResult->getResultList(); QList<Die*> diceList2=m_diceResult->getResultList(); // half-interval search sorting for(int i = 0; i<diceList.size();++i) { - Die* tmp1 = diceList[i]; + + Die* tmp1 = new Die(); + *tmp1=*diceList[i]; + diceList[i]->displayed(); + int j =0; bool found = false; int start = 0; |