mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
if (_status == Status::Finished) return;
|
||||||
_status = Status::Finished;
|
_status = Status::Finished;
|
||||||
|
|
||||||
for (const auto request : base::take(_requests)) {
|
const auto requests = base::take(_requests);
|
||||||
|
for (const auto request : requests) {
|
||||||
request->abort();
|
request->abort();
|
||||||
request->deleteLater();
|
request->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,8 +104,9 @@ std::vector<DnsEntry> ParseDnsResponse(
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto array = (*answerIt).toArray();
|
||||||
auto result = std::vector<DnsEntry>();
|
auto result = std::vector<DnsEntry>();
|
||||||
for (const auto elem : (*answerIt).toArray()) {
|
for (const auto elem : array) {
|
||||||
if (!elem.isObject()) {
|
if (!elem.isObject()) {
|
||||||
LOG(("Config Error: Not an object found "
|
LOG(("Config Error: Not an object found "
|
||||||
"in Answer array in dns response JSON."));
|
"in Answer array in dns response JSON."));
|
||||||
|
|
|
@ -733,8 +733,9 @@ void Panel::switchInlineQueryMessage(const QJsonObject &args) {
|
||||||
u"groups"_q,
|
u"groups"_q,
|
||||||
u"channels"_q,
|
u"channels"_q,
|
||||||
};
|
};
|
||||||
|
const auto typeArray = args["chat_types"].toArray();
|
||||||
auto types = std::vector<QString>();
|
auto types = std::vector<QString>();
|
||||||
for (const auto &value : args["chat_types"].toArray()) {
|
for (const auto &value : typeArray) {
|
||||||
const auto type = value.toString();
|
const auto type = value.toString();
|
||||||
if (valid.contains(type)) {
|
if (valid.contains(type)) {
|
||||||
types.push_back(type);
|
types.push_back(type);
|
||||||
|
@ -810,8 +811,9 @@ void Panel::openPopup(const QJsonObject &args) {
|
||||||
{ "cancel", Type::Cancel },
|
{ "cancel", Type::Cancel },
|
||||||
{ "destructive", Type::Destructive },
|
{ "destructive", Type::Destructive },
|
||||||
};
|
};
|
||||||
|
const auto buttonArray = args["buttons"].toArray();
|
||||||
auto buttons = std::vector<Webview::PopupArgs::Button>();
|
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 fields = button.toObject();
|
||||||
const auto i = types.find(fields["type"].toString());
|
const auto i = types.find(fields["type"].toString());
|
||||||
if (i == end(types)) {
|
if (i == end(types)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue