mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Ensure temporaries don't detach with range loop
This commit is contained in:
parent
26df482b54
commit
fdef19a009
3 changed files with 8 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -104,8 +104,9 @@ std::vector<DnsEntry> ParseDnsResponse(
|
|||
return {};
|
||||
}
|
||||
|
||||
const auto array = (*answerIt).toArray();
|
||||
auto result = std::vector<DnsEntry>();
|
||||
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."));
|
||||
|
|
|
@ -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<QString>();
|
||||
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<Webview::PopupArgs::Button>();
|
||||
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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue