fix: ensure finished signal is emited

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2023-06-25 16:13:26 -07:00
parent c49ee87857
commit b142407b21
2 changed files with 12 additions and 0 deletions

View File

@ -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()