From 141a2d285681a2f87a6057a26a3167daa2d8b716 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 11 Mar 2018 22:25:07 +0800 Subject: [PATCH] Prevent detach from containers --- src/base/rss/rss_autodownloader.cpp | 2 +- src/webui/api/torrentscontroller.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/base/rss/rss_autodownloader.cpp b/src/base/rss/rss_autodownloader.cpp index f18afaec7..1e070f26f 100644 --- a/src/base/rss/rss_autodownloader.cpp +++ b/src/base/rss/rss_autodownloader.cpp @@ -275,7 +275,7 @@ void AutoDownloader::importRulesFromLegacyFormat(const QByteArray &data) if (in.status() != QDataStream::Ok) throw ParsingError(tr("Invalid data format")); - for (const QVariant &val : dict) + for (const QVariant &val : qAsConst(dict)) insertRule(AutoDownloadRule::fromLegacyDict(val.toHash())); } diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 8aea27c0b..8b6f25e76 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -43,6 +43,7 @@ #include "base/bittorrent/torrenthandle.h" #include "base/bittorrent/torrentinfo.h" #include "base/bittorrent/trackerentry.h" +#include "base/global.h" #include "base/logger.h" #include "base/net/downloadmanager.h" #include "base/torrentfilter.h" @@ -493,7 +494,7 @@ void TorrentsController::addAction() params.downloadLimit = (dlLimit > 0) ? dlLimit : -1; bool partialSuccess = false; - for (QString url : urls.split('\n')) { + for (QString url : copyAsConst(urls.split('\n'))) { url = url.trimmed(); if (!url.isEmpty()) { Net::DownloadManager::instance()->setCookiesFromUrl(cookies, QUrl::fromEncoded(url.toUtf8()));