mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
Ensure temporaries don't detach with range loop
This commit is contained in:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user