1. Fixed order of initializations in constructor so gcc won't complain.

2. Added call  to PhraseDictionary.release(TargetPhraseCollection*) to
   release used TargetPhraseCollection's.
This commit is contained in:
germann 2014-03-24 10:55:47 +00:00
parent ec6fd21603
commit f7ec2ee09a

View File

@ -5,7 +5,7 @@
#include "TypeDef.h" #include "TypeDef.h"
#include "AlignmentInfo.h" #include "AlignmentInfo.h"
#include "util/exception.hh" #include "util/exception.hh"
#include "TranslationModel/PhraseDictionary.h"
using namespace std; using namespace std;
namespace Moses namespace Moses
@ -18,8 +18,8 @@ InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms,
,m_phrase(phrase) ,m_phrase(phrase)
,m_range(range) ,m_range(range)
,m_inputScore(inputScore) ,m_inputScore(inputScore)
,m_sourceNonTerms(sourceNonTerms)
,m_nextNode(1) ,m_nextNode(1)
,m_sourceNonTerms(sourceNonTerms)
{ {
//cerr << "phrase=" << phrase << " m_inputScore=" << *m_inputScore << endl; //cerr << "phrase=" << phrase << " m_inputScore=" << *m_inputScore << endl;
@ -27,6 +27,14 @@ InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms,
InputPath::~InputPath() InputPath::~InputPath()
{ {
// Since there is no way for the Phrase Dictionaries to tell in
// which (sentence) context phrases were looked up, we tell them
// now that the phrase isn't needed any more by this inputPath
typedef std::pair<const TargetPhraseCollection*, const void* > entry;
std::map<const PhraseDictionary*, entry>::const_iterator iter;
for (iter = m_targetPhrases.begin(); iter != m_targetPhrases.end(); ++iter)
iter->first->release(iter->second.first);
delete m_inputScore; delete m_inputScore;
} }