Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F112402
D177.1732308582.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D177.1732308582.diff
View Options
diff --git a/src/kazv-io-manager.cpp b/src/kazv-io-manager.cpp
--- a/src/kazv-io-manager.cpp
+++ b/src/kazv-io-manager.cpp
@@ -46,7 +46,7 @@
*/
QDir cacheDir{tmpDir.path()};
Kazv::RandomInterface randomGenerator = QtRandAdapter{};
- QMap<QString, QSharedPointer<KazvIODownloadJob>> cacheJobs;
+ QMap<QString, QPointer<KazvIODownloadJob>> cacheJobs;
QMap<QString, QSharedPointer<KazvIODownloadJob>> downloadJobs;
QMap<QString, QSharedPointer<UploadJobModel>> uploadJobs;
};
@@ -80,8 +80,9 @@
QDir dir(m_d->cacheDir.path());
if (!dir.exists(id) && this->getCacheJob(id) == nullptr) {
auto job = this->makeDownloadJob(fileUrl, QUrl::fromLocalFile(filePath), hash, key, iv);
- m_d->cacheJobs[id].reset(job);
+ m_d->cacheJobs[id] = job;
connect(job, &KazvIOBaseJob::result, this, [this, id](auto /* result */) {
+ m_d->cacheJobs[id]->deleteLater();
m_d->cacheJobs.remove(id);
});
}
@@ -184,6 +185,10 @@
void KazvIOManager::clearJobs()
{
+ auto cacheJobKeys = m_d->cacheJobs.keys();
+ std::for_each(cacheJobKeys.begin(), cacheJobKeys.end(), [this](auto key) {
+ m_d->cacheJobs[key]->cancel();
+ });
std::for_each(m_d->downloadJobs.begin(), m_d->downloadJobs.end(), [this](auto job){
job->cancel();
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 12:49 PM (4 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38975
Default Alt Text
D177.1732308582.diff (1 KB)
Attached To
Mode
D177: Fix the problem that kazv cannot be closed when cached files
Attached
Detach File
Event Timeline
Log In to Comment