diff --git a/Telegram/SourceFiles/mtproto/connection_http.cpp b/Telegram/SourceFiles/mtproto/connection_http.cpp index ad899df2e..baaad903e 100644 --- a/Telegram/SourceFiles/mtproto/connection_http.cpp +++ b/Telegram/SourceFiles/mtproto/connection_http.cpp @@ -55,7 +55,8 @@ void HttpConnection::disconnectFromServer() { if (_status == Status::Finished) return; _status = Status::Finished; - for (const auto request : base::take(_requests)) { + const auto requests = base::take(_requests); + for (const auto request : requests) { request->abort(); request->deleteLater(); } diff --git a/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp b/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp index f20bb78e0..d34d6e90d 100644 --- a/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp +++ b/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp @@ -104,8 +104,9 @@ std::vector ParseDnsResponse( return {}; } + const auto array = (*answerIt).toArray(); auto result = std::vector(); - for (const auto elem : (*answerIt).toArray()) { + for (const auto elem : array) { if (!elem.isObject()) { LOG(("Config Error: Not an object found " "in Answer array in dns response JSON.")); diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index 24a1a6e27..209444ff1 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -733,8 +733,9 @@ void Panel::switchInlineQueryMessage(const QJsonObject &args) { u"groups"_q, u"channels"_q, }; + const auto typeArray = args["chat_types"].toArray(); auto types = std::vector(); - for (const auto &value : args["chat_types"].toArray()) { + for (const auto &value : typeArray) { const auto type = value.toString(); if (valid.contains(type)) { types.push_back(type); @@ -810,8 +811,9 @@ void Panel::openPopup(const QJsonObject &args) { { "cancel", Type::Cancel }, { "destructive", Type::Destructive }, }; + const auto buttonArray = args["buttons"].toArray(); auto buttons = std::vector(); - for (const auto button : args["buttons"].toArray()) { + for (const auto button : buttonArray) { const auto fields = button.toObject(); const auto i = types.find(fields["type"].toString()); if (i == end(types)) {