diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index 93f0846..ffcd191 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -666,6 +666,8 @@ void ContentManager::cancelBook(const QString& id) if (download->getStatus() != kiwix::Download::K_COMPLETE) { download->cancelDownload(); } + m_downloads.remove(id); + QString dirPath = QString::fromStdString(kiwix::removeLastPathElement(download->getPath())); QString filename = QString::fromStdString(kiwix::getLastPathElement(download->getPath())) + "*"; // incompleted downloaded file should be perma deleted diff --git a/src/contentmanagermodel.cpp b/src/contentmanagermodel.cpp index 9610414..4c80d3d 100644 --- a/src/contentmanagermodel.cpp +++ b/src/contentmanagermodel.cpp @@ -282,7 +282,6 @@ void ContentManagerModel::resumeDownload(QModelIndex index) void ContentManagerModel::removeDownload(QString bookId) { - m_downloads.remove(bookId); const auto it = bookIdToRowMap.constFind(bookId); if ( it == bookIdToRowMap.constEnd() ) return;