From d1fe1b89ae570665f43f2a0fb97f4c38f1c06d0f Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 7 Feb 2023 10:37:27 +0100 Subject: [PATCH] Do not automatically update the status of existing Download. User may already have a pointer to the `Download` and it is not protected against concurrent access. We could update the status of new created `Download` as by definition, no one have a pointer on it. But it better to not do it neither : - For consistency - Because the first call on update status may be long on windows (because of file preallocation). It is better to not block the downloader for that. --- src/downloader.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/downloader.cpp b/src/downloader.cpp index 9bffad38..cd342b3e 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -180,23 +180,20 @@ Download* Downloader::startDownload(const std::string& uri, const std::vectorupdateStatus(true); return m_knownDownloads.at(did).get(); } catch(std::exception& e) { for (auto gid : mp_aria->tellActive()) { if (gid == did) { m_knownDownloads[gid] = std::unique_ptr(new Download(mp_aria, gid)); - m_knownDownloads.at(gid).get()->updateStatus(true); return m_knownDownloads[gid].get(); } } for (auto gid : mp_aria->tellWaiting()) { if (gid == did) { m_knownDownloads[gid] = std::unique_ptr(new Download(mp_aria, gid)); - m_knownDownloads.at(gid).get()->updateStatus(true); return m_knownDownloads[gid].get(); } - } + } throw e; } }