Fix possible crash in non-cancelled request.

This commit is contained in:
John Preston 2023-10-28 21:13:52 +04:00
parent 49bc8ccd6a
commit c480ab1a3b
1 changed files with 4 additions and 5 deletions

View File

@ -123,6 +123,7 @@ void GroupCall::requestParticipants() {
return;
}
}
api().request(base::take(_participantsRequestId)).cancel();
_participantsRequestId = api().request(MTPphone_GetGroupParticipants(
input(),
MTP_vector<MTPInputPeer>(), // ids
@ -132,8 +133,8 @@ void GroupCall::requestParticipants() {
: _nextOffset),
MTP_int(kRequestPerPage)
)).done([=](const MTPphone_GroupParticipants &result) {
_participantsRequestId = 0;
result.match([&](const MTPDphone_groupParticipants &data) {
_participantsRequestId = 0;
const auto reloaded = processSavedFullCall();
_nextOffset = qs(data.vnext_offset());
_peer->owner().processUsers(data.vusers());
@ -168,7 +169,7 @@ bool GroupCall::processSavedFullCall() {
if (!_savedFull) {
return false;
}
_reloadRequestId = 0;
api().request(base::take(_reloadRequestId)).cancel();
_reloadLastFinished = crl::now();
processFullCallFields(*base::take(_savedFull));
return true;
@ -511,10 +512,8 @@ void GroupCall::reloadIfStale() {
void GroupCall::reload() {
if (_reloadRequestId || _applyingQueuedUpdates) {
return;
} else if (_participantsRequestId) {
api().request(_participantsRequestId).cancel();
_participantsRequestId = 0;
}
api().request(base::take(_participantsRequestId)).cancel();
DEBUG_LOG(("Group Call Participants: "
"Reloading with queued: %1"