Fixed an issue where an ACTOR outlives an object passed to it and then crashes while accessing it.

This commit is contained in:
Balachandar Namasivayam 2017-11-14 13:51:23 -08:00
parent 313e823629
commit 986b73f458
1 changed files with 2 additions and 1 deletions

View File

@ -56,10 +56,11 @@ template<> Tuple Codec<ERestoreState>::pack(ERestoreState const &val) { return T
template<> ERestoreState Codec<ERestoreState>::unpack(Tuple const &val) { return (ERestoreState)val.getInt(0); }
ACTOR Future<std::vector<KeyBackedTag>> TagUidMap::getAll_impl(TagUidMap *tagsMap, Reference<ReadYourWritesTransaction> tr) {
state Key prefix = tagsMap->prefix; // Copying it here as tagsMap lifetime is not tied to this actor
TagMap::PairsType tagPairs = wait(tagsMap->getRange(tr, std::string(), {}, 1e6));
std::vector<KeyBackedTag> results;
for(auto &p : tagPairs)
results.push_back(KeyBackedTag(p.first, tagsMap->prefix));
results.push_back(KeyBackedTag(p.first, prefix));
return results;
}