diff --git a/include/crucible/cache.h b/include/crucible/cache.h index dac2a8a..60d2a7f 100644 --- a/include/crucible/cache.h +++ b/include/crucible/cache.h @@ -154,7 +154,9 @@ namespace crucible { if (!inserted) { found->second.first = m_ctr++; } - return found->second.second; + // Make copy before releasing lock + auto rv = found->second.second; + return rv; } template