From 1ea61db1fb6467f00463933092791958a27dedb3 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 3 Apr 2019 23:53:38 +0800 Subject: [PATCH 1/2] Disable downloading tracker favicons by default Workaround for a crash in Qt networking library, source: https://github.com/qbittorrent/qBittorrent/issues/9667#issuecomment-464445025 Closes #9667. --- src/gui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index a77b36297..ad6f8383d 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -518,7 +518,7 @@ void MainWindow::setTorrentAddedNotificationsEnabled(bool value) bool MainWindow::isDownloadTrackerFavicon() const { - return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, true).toBool(); + return settings()->loadValue(KEY_DOWNLOAD_TRACKER_FAVICON, false).toBool(); } void MainWindow::setDownloadTrackerFavicon(bool value) From 4bf43138622d582f20940a3c52260f7063743d78 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 7 Apr 2019 20:05:02 +0800 Subject: [PATCH 2/2] Initialize class variable via constructor --- src/gui/mainwindow.cpp | 3 +-- src/gui/transferlistfilterswidget.cpp | 8 ++++---- src/gui/transferlistfilterswidget.h | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ad6f8383d..1f1210039 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -238,8 +238,7 @@ MainWindow::MainWindow(QWidget *parent) // m_transferListWidget->setStyleSheet("QTreeView {border: none;}"); // borderless m_propertiesWidget = new PropertiesWidget(hSplitter); connect(m_transferListWidget, &TransferListWidget::currentTorrentChanged, m_propertiesWidget, &PropertiesWidget::loadTorrentInfos); - m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget); - m_transferListFiltersWidget->setDownloadTrackerFavicon(isDownloadTrackerFavicon()); + m_transferListFiltersWidget = new TransferListFiltersWidget(m_splitter, m_transferListWidget, isDownloadTrackerFavicon()); hSplitter->addWidget(m_transferListWidget); hSplitter->addWidget(m_propertiesWidget); m_splitter->addWidget(m_transferListFiltersWidget); diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index 8eaf58012..a75934ed1 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -192,10 +192,10 @@ void StatusFilterWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {} void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {} -TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList) +TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon) : BaseFilterWidget(parent, transferList) , m_totalTorrents(0) - , m_downloadTrackerFavicon(true) + , m_downloadTrackerFavicon(downloadFavicon) { auto *allTrackers = new QListWidgetItem(this); allTrackers->setData(Qt::DisplayRole, QVariant(tr("All (0)", "this is for the tracker filter"))); @@ -545,7 +545,7 @@ QStringList TrackerFiltersList::getHashes(int row) return m_trackers.value(trackerFromRow(row)); } -TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList) +TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon) : QFrame(parent) , m_transferList(transferList) { @@ -625,7 +625,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi trackerLabel->setFont(font); frameLayout->addWidget(trackerLabel); - m_trackerFilters = new TrackerFiltersList(this, transferList); + m_trackerFilters = new TrackerFiltersList(this, transferList, downloadFavicon); frameLayout->addWidget(m_trackerFilters); connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter); diff --git a/src/gui/transferlistfilterswidget.h b/src/gui/transferlistfilterswidget.h index da5422905..08ea067c9 100644 --- a/src/gui/transferlistfilterswidget.h +++ b/src/gui/transferlistfilterswidget.h @@ -98,7 +98,7 @@ class TrackerFiltersList : public BaseFilterWidget Q_DISABLE_COPY(TrackerFiltersList) public: - TrackerFiltersList(QWidget *parent, TransferListWidget *transferList); + TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, bool downloadFavicon); ~TrackerFiltersList() override; // Redefine addItem() to make sure the list stays sorted @@ -144,7 +144,7 @@ class TransferListFiltersWidget : public QFrame Q_OBJECT public: - TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList); + TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList, bool downloadFavicon); void setDownloadTrackerFavicon(bool value); public slots: