mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
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:
parent
a14dbffb65
commit
3c931b11d6
1 changed files with 4 additions and 4 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue