Skip to content
Snippets Groups Projects
Commit a6fd8c0c authored by Adam Radziszewski's avatar Adam Radziszewski
Browse files

fix MWEReader's get_next_token -- return token clones as "the caller must...

fix MWEReader's get_next_token -- return token clones as "the caller must dispose of the Token it receives" (according to Corpus2 API docs)
parent 160fa59c
No related merge requests found
...@@ -52,7 +52,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>( ...@@ -52,7 +52,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>(
std::vector<Token*> tokens = currentSentence->tokens(); std::vector<Token*> tokens = currentSentence->tokens();
if(token_index<tokens.size()) if(token_index<tokens.size())
{ {
return tokens.at(token_index++); return tokens.at(token_index++)->clone();
} }
else else
{ {
...@@ -66,7 +66,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>( ...@@ -66,7 +66,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>(
} }
tokens = currentSentence->tokens(); tokens = currentSentence->tokens();
token_index=0; token_index=0;
return tokens.at(token_index++); return tokens.at(token_index++)->clone();
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment