From 960f50824df825650dc929bc265554b0c24ce249 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 22 Jan 2020 16:13:47 +0300 Subject: [PATCH] Fix one more crash in CDN file download. The sessionTimedOut could remove a session right between a request for a file part and a request for additional cdn file hashes. In this case requestData.sessionIndex was not updated and this was leading to an assertion violation in changeRequestedAmount. --- Telegram/SourceFiles/storage/download_manager_mtproto.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/storage/download_manager_mtproto.cpp b/Telegram/SourceFiles/storage/download_manager_mtproto.cpp index fa04c11062..97bea4fb0c 100644 --- a/Telegram/SourceFiles/storage/download_manager_mtproto.cpp +++ b/Telegram/SourceFiles/storage/download_manager_mtproto.cpp @@ -252,7 +252,9 @@ void DownloadManagerMtproto::requestSucceeded( if (duration >= kBadRequestDurationThreshold) { DEBUG_LOG(("Duration too large, signaling time out.")); - sessionTimedOut(dcId, index); + crl::on_main(this, [=] { + sessionTimedOut(dcId, index); + }); return; } if (amountAtRequestStart == data.maxWaitedAmount