Fix request cancel in Histories.

This commit is contained in:
John Preston 2020-02-21 17:36:49 +04:00
parent f9d02740aa
commit 7f77db8c7f
1 changed files with 5 additions and 1 deletions

View File

@ -621,7 +621,11 @@ void Histories::finishSentRequest(
not_null<State*> state,
int id) {
_historyByRequest.remove(id);
state->sent.remove(id);
const auto i = state->sent.find(id);
if (i != end(state->sent)) {
session().api().request(i->second.id).cancel();
state->sent.erase(i);
}
if (!state->postponed.empty() && !postponeHistoryRequest(*state)) {
for (auto &[id, postponed] : base::take(state->postponed)) {
const auto requestId = postponed.generator([=] {