Skip to content

Commit d5c0c09

Browse files
committed
Don't forget to delete TorrentContentAdaptor instance
PR qbittorrent#19825. Closes qbittorrent#19816.
1 parent 3c0747f commit d5c0c09

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/gui/addnewtorrentdialog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ void AddNewTorrentDialog::contentLayoutChanged()
767767

768768
const auto contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
769769
m_contentAdaptor->applyContentLayout(contentLayout);
770-
m_ui->contentTreeView->setContentHandler(m_contentAdaptor); // to cause reloading
770+
m_ui->contentTreeView->setContentHandler(m_contentAdaptor.get()); // to cause reloading
771771
}
772772

773773
void AddNewTorrentDialog::saveTorrentFile()
@@ -992,7 +992,7 @@ void AddNewTorrentDialog::setupTreeview()
992992
if (m_torrentParams.filePaths.isEmpty())
993993
m_torrentParams.filePaths = m_torrentInfo.filePaths();
994994

995-
m_contentAdaptor = new TorrentContentAdaptor(m_torrentInfo, m_torrentParams.filePaths, m_torrentParams.filePriorities);
995+
m_contentAdaptor = std::make_unique<TorrentContentAdaptor>(m_torrentInfo, m_torrentParams.filePaths, m_torrentParams.filePriorities);
996996

997997
const auto contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
998998
m_contentAdaptor->applyContentLayout(contentLayout);
@@ -1013,7 +1013,7 @@ void AddNewTorrentDialog::setupTreeview()
10131013
m_contentAdaptor->prioritizeFiles(priorities);
10141014
}
10151015

1016-
m_ui->contentTreeView->setContentHandler(m_contentAdaptor);
1016+
m_ui->contentTreeView->setContentHandler(m_contentAdaptor.get());
10171017

10181018
m_filterLine->blockSignals(false);
10191019

src/gui/addnewtorrentdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private slots:
116116
void showEvent(QShowEvent *event) override;
117117

118118
Ui::AddNewTorrentDialog *m_ui = nullptr;
119-
TorrentContentAdaptor *m_contentAdaptor = nullptr;
119+
std::unique_ptr<TorrentContentAdaptor> m_contentAdaptor;
120120
BitTorrent::MagnetUri m_magnetURI;
121121
BitTorrent::TorrentInfo m_torrentInfo;
122122
int m_savePathIndex = -1;

0 commit comments

Comments
 (0)