mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Fixed crash on choosing non-writable download location.
This commit is contained in:
parent
8f06ad811b
commit
de7c9d56d3
@ -320,13 +320,19 @@ void DownloadItem::stop(bool askForDeleteFile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_downloadStopped = true;
|
m_downloadStopped = true;
|
||||||
QString host = m_reply ? m_reply->url().host() : m_ftpDownloader->url().host();
|
QString host;
|
||||||
|
if (m_reply) {
|
||||||
|
host = m_reply->url().host();
|
||||||
|
}
|
||||||
|
else if (m_ftpDownloader) {
|
||||||
|
host = m_ftpDownloader->url().host();
|
||||||
|
}
|
||||||
m_openAfterFinish = false;
|
m_openAfterFinish = false;
|
||||||
m_timer.stop();
|
m_timer.stop();
|
||||||
if (m_reply) {
|
if (m_reply) {
|
||||||
m_reply->abort();
|
m_reply->abort();
|
||||||
}
|
}
|
||||||
else {
|
else if (m_ftpDownloader) {
|
||||||
m_ftpDownloader->abort();
|
m_ftpDownloader->abort();
|
||||||
m_ftpDownloader->close();
|
m_ftpDownloader->close();
|
||||||
}
|
}
|
||||||
@ -454,8 +460,8 @@ void DownloadItem::error()
|
|||||||
ui->downloadInfo->setText(tr("Error: ") + m_reply->errorString());
|
ui->downloadInfo->setText(tr("Error: ") + m_reply->errorString());
|
||||||
}
|
}
|
||||||
else if (m_ftpDownloader && m_ftpDownloader->error() != QFtp::NoError) {
|
else if (m_ftpDownloader && m_ftpDownloader->error() != QFtp::NoError) {
|
||||||
ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString());
|
|
||||||
stop(false);
|
stop(false);
|
||||||
|
ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,9 +470,10 @@ void DownloadItem::updateDownload()
|
|||||||
#ifdef DOWNMANAGER_DEBUG
|
#ifdef DOWNMANAGER_DEBUG
|
||||||
qDebug() << __FUNCTION__ ;
|
qDebug() << __FUNCTION__ ;
|
||||||
#endif
|
#endif
|
||||||
bool downoaderIsFinished = (m_reply && m_reply->isFinished())
|
// after caling stop() (from readyRead()) m_reply will be a dangling pointer,
|
||||||
|| (m_ftpDownloader && m_ftpDownloader->isFinished());
|
// thus it should be checked after m_outputFile.isOpen()
|
||||||
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() && downoaderIsFinished) {
|
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() &&
|
||||||
|
((m_reply && m_reply->isFinished()) || (m_ftpDownloader && m_ftpDownloader->isFinished()))) {
|
||||||
downloadProgress(0, 0);
|
downloadProgress(0, 0);
|
||||||
finished();
|
finished();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user