Clear CacheHelper::waiting mutex in time.

I hope this fixes crashes in streaming semaphore usage.

CacheHelper::waiting points to Context::_semaphore, so it
should be cleared before Context is destroyed, not later.
This commit is contained in:
John Preston 2023-09-18 12:10:30 +04:00
parent a14dbffb65
commit 3c931b11d6
1 changed files with 4 additions and 4 deletions

View File

@ -903,6 +903,10 @@ void Reader::stopStreaming(bool stillActive) {
_stopStreamingAsync = false;
_waiting.store(nullptr, std::memory_order_release);
if (_cacheHelper && _cacheHelper->waiting != nullptr) {
QMutexLocker lock(&_cacheHelper->mutex);
_cacheHelper->waiting.store(nullptr, std::memory_order_release);
}
if (!stillActive) {
_streamingActive = false;
refreshLoaderPriority();
@ -1379,10 +1383,6 @@ void Reader::finalizeCache() {
return;
}
Assert(_cache != nullptr);
if (_cacheHelper->waiting != nullptr) {
QMutexLocker lock(&_cacheHelper->mutex);
_cacheHelper->waiting.store(nullptr, std::memory_order_release);
}
auto toCache = _slices.unloadToCache();
while (toCache.number >= 0) {
putToCache(std::move(toCache));