Skip to content

Commit bfb663a

Browse files
glassezRadu Carpa
authored andcommitted
Don't forget to delete TorrentContentAdaptor instance
PR qbittorrent#19825. Closes qbittorrent#19816.
1 parent 21617f4 commit bfb663a

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
@@ -725,7 +725,7 @@ void AddNewTorrentDialog::contentLayoutChanged()
725725

726726
const auto contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
727727
m_contentAdaptor->applyContentLayout(contentLayout);
728-
m_ui->contentTreeView->setContentHandler(m_contentAdaptor); // to cause reloading
728+
m_ui->contentTreeView->setContentHandler(m_contentAdaptor.get()); // to cause reloading
729729
}
730730

731731
void AddNewTorrentDialog::saveTorrentFile()
@@ -952,7 +952,7 @@ void AddNewTorrentDialog::setupTreeview()
952952
if (m_torrentParams.filePaths.isEmpty())
953953
m_torrentParams.filePaths = torrentInfo.filePaths();
954954

955-
m_contentAdaptor = new TorrentContentAdaptor(torrentInfo, m_torrentParams.filePaths, m_torrentParams.filePriorities);
955+
m_contentAdaptor = std::make_unique<TorrentContentAdaptor>(torrentInfo, m_torrentParams.filePaths, m_torrentParams.filePriorities);
956956

957957
const auto contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
958958
m_contentAdaptor->applyContentLayout(contentLayout);
@@ -973,7 +973,7 @@ void AddNewTorrentDialog::setupTreeview()
973973
m_contentAdaptor->prioritizeFiles(priorities);
974974
}
975975

976-
m_ui->contentTreeView->setContentHandler(m_contentAdaptor);
976+
m_ui->contentTreeView->setContentHandler(m_contentAdaptor.get());
977977

978978
m_filterLine->blockSignals(false);
979979

src/gui/addnewtorrentdialog.h

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

116116
Ui::AddNewTorrentDialog *m_ui = nullptr;
117-
TorrentContentAdaptor *m_contentAdaptor = nullptr;
117+
std::unique_ptr<TorrentContentAdaptor> m_contentAdaptor;
118118
BitTorrent::TorrentDescriptor m_torrentDescr;
119119
int m_savePathIndex = -1;
120120
int m_downloadPathIndex = -1;

0 commit comments

Comments
 (0)