From b142407b218383992f854486cabebb766e83fa93 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sun, 25 Jun 2023 16:13:26 -0700 Subject: [PATCH] fix: ensure `finished` signal is emited Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/net/Download.cpp | 6 ++++++ launcher/net/Upload.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index 40d8a5bba..c08281854 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -118,6 +118,7 @@ void Download::executeTask() case State::Succeeded: qCDebug(taskDownloadLogC) << getUid().toString() << "Download cache hit " << m_url.toString(); emit succeeded(); + emit finished(); return; case State::Running: qCDebug(taskDownloadLogC) << getUid().toString() << "Downloading " << m_url.toString(); @@ -295,18 +296,21 @@ void Download::downloadFinished() m_sink->abort(); m_reply.reset(); emit succeeded(); + emit finished(); return; } else if (m_state == State::Failed) { qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed in previous step:" << m_url.toString(); m_sink->abort(); m_reply.reset(); emit failed(""); + emit finished(); return; } else if (m_state == State::AbortedByUser) { qCDebug(taskDownloadLogC) << getUid().toString() << "Download aborted in previous step:" << m_url.toString(); m_sink->abort(); m_reply.reset(); emit aborted(); + emit finished(); return; } @@ -324,12 +328,14 @@ void Download::downloadFinished() m_sink->abort(); m_reply.reset(); emit failed(""); + emit finished(); return; } m_reply.reset(); qCDebug(taskDownloadLogC) << getUid().toString() << "Download succeeded:" << m_url.toString(); emit succeeded(); + emit finished(); } void Download::downloadReadyRead() diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index 0688c5a80..d9115ede1 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -158,18 +158,21 @@ void Upload::downloadFinished() m_sink->abort(); m_reply.reset(); emit succeeded(); + emit finished(); return; } else if (m_state == State::Failed) { qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed in previous step:" << m_url.toString(); m_sink->abort(); m_reply.reset(); emit failed(""); + emit finished(); return; } else if (m_state == State::AbortedByUser) { qCDebug(taskUploadLogC) << getUid().toString() << "Upload aborted in previous step:" << m_url.toString(); m_sink->abort(); m_reply.reset(); emit aborted(); + emit finished(); return; } @@ -187,11 +190,13 @@ void Upload::downloadFinished() m_sink->abort(); m_reply.reset(); emit failed(""); + emit finished(); return; } m_reply.reset(); qCDebug(taskUploadLogC) << getUid().toString() << "Upload succeeded:" << m_url.toString(); emit succeeded(); + emit finished(); } void Upload::downloadReadyRead() @@ -209,6 +214,7 @@ void Upload::executeTask() if (m_state == State::AbortedByUser) { qCWarning(taskUploadLogC) << getUid().toString() << "Attempt to start an aborted Upload:" << m_url.toString(); emit aborted(); + emit finished(); return; } QNetworkRequest request(m_url);