Properly clear out download list before calling torrent::cleanup().

This commit is contained in:
rakshasa
2025-05-30 10:49:28 +02:00
committed by Jari Sundell
parent 2d565d1c80
commit df8cb53ed2
+7 -3
View File
@@ -43,10 +43,14 @@ DownloadList::check_contains([[maybe_unused]] Download* d) {
void void
DownloadList::clear() { DownloadList::clear() {
std::for_each(begin(), end(), [&](Download* d) { close(d); }); while (!empty()) {
std::for_each(begin(), end(), [](Download* d) { delete d; }); auto download = back();
base_type::pop_back();
base_type::clear(); close(download);
torrent::download_remove(*download->download());
delete download;
}
} }
void void