From c01aed8d9032c13225d6ced135add6895d0d8413 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 4 Jun 2019 00:14:57 +0800 Subject: [PATCH] Remove redundant disconnect() The dialog is going out-of-scope in these instance and the signal-slot connection will disconnect automatically. --- src/gui/addnewtorrentdialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 759a17d1a..e3855cd25 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -615,9 +615,6 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &) void AddNewTorrentDialog::accept() { - if (!m_hasMetadata) - disconnect(this, SLOT(updateMetadata(const BitTorrent::TorrentInfo&))); - // TODO: Check if destination actually exists m_torrentParams.skipChecking = m_ui->skipCheckingCheckBox->isChecked(); @@ -663,7 +660,6 @@ void AddNewTorrentDialog::accept() void AddNewTorrentDialog::reject() { if (!m_hasMetadata) { - disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo))); setMetadataProgressIndicator(false); BitTorrent::Session::instance()->cancelLoadMetadata(m_hash); } @@ -675,7 +671,8 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info) { if (info.hash() != m_hash) return; - disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo))); + disconnect(BitTorrent::Session::instance(), &BitTorrent::Session::metadataLoaded, this, &AddNewTorrentDialog::updateMetadata); + if (!info.isValid()) { RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata.")); setMetadataProgressIndicator(false, tr("Invalid metadata"));