diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-06-06 09:40:22 +0200 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2020-06-06 13:20:14 +0200 |
commit | a436eff5deb18031fad89345d45be01d1d481466 (patch) | |
tree | 01325ae3ef0e0cdc1068324962f7a70fbb960250 /src/track | |
parent | f23fa695df4aaf6679ad9222d2e04834325d9d77 (diff) |
Delete out-of-context debug assertion
This assertion will be verified by implementations of
GlobalTrackCacheSaver separately.
Diffstat (limited to 'src/track')
-rw-r--r-- | src/track/globaltrackcache.cpp | 5 | ||||
-rw-r--r-- | src/track/globaltrackcache.h | 18 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/track/globaltrackcache.cpp b/src/track/globaltrackcache.cpp index 95474bd2d5..b5da81acfa 100644 --- a/src/track/globaltrackcache.cpp +++ b/src/track/globaltrackcache.cpp @@ -675,11 +675,6 @@ void GlobalTrackCache::slotEvictAndSave( DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); DEBUG_ASSERT(cacheEntryPtr); - // We need to be sure this is always called from the main thread - // because we can only access the DB from it and we must not lose the - // the lock until all changes are persistently stored in file and DB - // to not hand out the track again with old metadata. - DEBUG_ASSERT(QApplication::instance()->thread() == QThread::currentThread()); GlobalTrackCacheLocker cacheLocker; if (!cacheEntryPtr->expired()) { diff --git a/src/track/globaltrackcache.h b/src/track/globaltrackcache.h index 10cf7d2415..5ea0ace327 100644 --- a/src/track/globaltrackcache.h +++ b/src/track/globaltrackcache.h @@ -174,13 +174,25 @@ private: TrackRef m_trackRef; }; +/// Callback interface for pre-delete actions class /*interface*/ GlobalTrackCacheSaver { private: friend class GlobalTrackCache; - virtual void saveEvictedTrack(Track* pEvictedTrack) noexcept = 0; -protected: - virtual ~GlobalTrackCacheSaver() {} + /// Perform actions that are necessary to save any pending + /// modifications of a Track object before it finally gets + /// deleted. + /// + /// GlobalTrackCache ensures that the given pointer is valid + /// and the last and only reference to this Track object. + /// + /// This callback method will always be invoked from the + /// event loop thread of the owning GlobalTrackCache instance. + virtual void saveEvictedTrack( + Track* pEvictedTrack) noexcept = 0; + + protected: + virtual ~GlobalTrackCacheSaver() = default; }; class GlobalTrackCache : public QObject { |