Skip to content
Snippets Groups Projects
Commit c48e1031 authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon: Committed by Adam Edward Barton
Browse files

fix bug in InternalOfflineFast

parent 57ba35a3
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,8 @@ void InternalOfflineFast::wait() const { ...@@ -27,7 +27,8 @@ void InternalOfflineFast::wait() const {
for(size_t i=0 ;i < m_fullMap.size(); ++i){ for(size_t i=0 ;i < m_fullMap.size(); ++i){
if(m_fullMap[i]) m_map.emplace_back(i, m_fullMap[i]); if(m_fullMap[i]) m_map.emplace_back(i, m_fullMap[i]);
} }
m_needsupdate.store(true); m_map.shrink_to_fit();
m_needsupdate.store(false);
} }
std::vector<IdentifierHash> InternalOfflineFast::getAllCurrentHashes() const { std::vector<IdentifierHash> InternalOfflineFast::getAllCurrentHashes() const {
...@@ -70,7 +71,15 @@ size_t InternalOfflineFast::numberOfCollections() const { ...@@ -70,7 +71,15 @@ size_t InternalOfflineFast::numberOfCollections() const {
} }
void InternalOfflineFast::cleanUp(deleter_f* deleter) noexcept { void InternalOfflineFast::cleanUp(deleter_f* deleter) noexcept {
for(const auto& x : m_map) { deleter(x.second); m_fullMap[x.first] = nullptr; } if(!m_needsupdate) {
for(const auto& x : m_map) { deleter(x.second); m_fullMap[x.first] = nullptr; }
if(!m_map.empty()) m_needsupdate.store(true, std::memory_order_relaxed);
}
else {
for(size_t i=0 ;i < m_fullMap.size(); ++i){
if(m_fullMap[i]) deleter(m_fullMap[i]);
}
}
m_map.clear(); m_map.clear();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment