mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00: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:
@@ -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));
|
||||
|
Reference in New Issue
Block a user