summaryrefslogtreecommitdiffstats
path: root/src/track
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2020-06-06 14:40:15 +0200
committerUwe Klotz <uklotz@mixxx.org>2020-06-06 14:40:35 +0200
commitdb68659b25f73c4e6ed2d709f27f314a43af50d3 (patch)
treed46c75cce11128017b2b86e16ae78b98c84b28eb /src/track
parentd06bc8abfa7f71b762fb8a219c6d5ad89cc254cb (diff)
Keep GlobalTrackCache locked until the entry has been deleted
Diffstat (limited to 'src/track')
-rw-r--r--src/track/globaltrackcache.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/track/globaltrackcache.cpp b/src/track/globaltrackcache.cpp
index f5450b22a6..0e7a2105b4 100644
--- a/src/track/globaltrackcache.cpp
+++ b/src/track/globaltrackcache.cpp
@@ -706,8 +706,12 @@ void GlobalTrackCache::slotEvictAndSave(
DEBUG_ASSERT(!isCached(cacheEntryPtr->getPlainPtr()));
saveEvictedTrack(cacheEntryPtr->getPlainPtr());
- // here the cacheEntryPtr goes out of scope, the cache entry is
- // deleted including the owned track
+ // Explicitly release the cacheEntryPtr including the owned
+ // track object while the cache is still locked.
+ cacheEntryPtr = {};
+
+ // Finally the exclusive lock on the cache is released implicitly
+ // when exiting the scope of this method.
}
bool GlobalTrackCache::tryEvict(Track* plainPtr) {