diff options
author | 2017-05-14 18:05:02 +0200 | |
---|---|---|
committer | 2017-05-18 00:07:45 +0200 | |
commit | f1bce2a565cb22376963d4a63d8b566a748c7559 (patch) | |
tree | 051e7a588e867a6514b05a3765b86e5ef1f87288 /kde-frameworks/kio/files | |
parent | dev-java/gcj-jdk: Version bump to 5.4.0 (diff) | |
download | gentoo-f1bce2a565cb22376963d4a63d8b566a748c7559.tar.gz gentoo-f1bce2a565cb22376963d4a63d8b566a748c7559.tar.bz2 gentoo-f1bce2a565cb22376963d4a63d8b566a748c7559.zip |
kde-frameworks/kio: Fix major PreviewJob bugs
- Cleanup temp files of failed get()
- Skip remote directories
See also KDE Bug: https://bugs.kde.org/show_bug.cgi?id=208625
Package-Manager: Portage-2.3.5, Repoman-2.3.1
Diffstat (limited to 'kde-frameworks/kio/files')
-rw-r--r-- | kde-frameworks/kio/files/kio-5.34.0-previewjob1.patch | 64 | ||||
-rw-r--r-- | kde-frameworks/kio/files/kio-5.34.0-previewjob2.patch | 35 |
2 files changed, 99 insertions, 0 deletions
diff --git a/kde-frameworks/kio/files/kio-5.34.0-previewjob1.patch b/kde-frameworks/kio/files/kio-5.34.0-previewjob1.patch new file mode 100644 index 000000000000..87ba27d807f8 --- /dev/null +++ b/kde-frameworks/kio/files/kio-5.34.0-previewjob1.patch @@ -0,0 +1,64 @@ +From 78c45a1ea0e28a98f34c6d113c807f14700b22d4 Mon Sep 17 00:00:00 2001 +From: David Faure <faure@kde.org> +Date: Sun, 14 May 2017 15:40:02 +0200 +Subject: [PATCH 1/2] PreviewJob: clean up empty temp file when get() fails. + +(e.g. because it's a directory) + +CCBUG: 208625 +--- + src/widgets/previewjob.cpp | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/src/widgets/previewjob.cpp b/src/widgets/previewjob.cpp +index 9eae3469..e836f7da 100644 +--- a/src/widgets/previewjob.cpp ++++ b/src/widgets/previewjob.cpp +@@ -143,6 +143,7 @@ public: + void getOrCreateThumbnail(); + bool statResultThumbnail(); + void createThumbnail(const QString &); ++ void cleanupTempFile(); + void determineNextFile(); + void emitPreview(const QImage &thumb); + +@@ -409,6 +410,16 @@ void PreviewJob::setIgnoreMaximumSize(bool ignoreSize) + d_func()->ignoreMaximumSize = ignoreSize; + } + ++void PreviewJobPrivate::cleanupTempFile() ++{ ++ if (!tempName.isEmpty()) { ++ Q_ASSERT(!QFileInfo(tempName).isDir()); ++ Q_ASSERT(QFileInfo(tempName).isFile()); ++ QFile::remove(tempName); ++ tempName.clear(); ++ } ++} ++ + void PreviewJobPrivate::determineNextFile() + { + Q_Q(PreviewJob); +@@ -491,6 +502,7 @@ void PreviewJob::slotResult(KJob *job) + } + case PreviewJobPrivate::STATE_GETORIG: { + if (job->error()) { ++ d->cleanupTempFile(); + d->determineNextFile(); + return; + } +@@ -499,10 +511,7 @@ void PreviewJob::slotResult(KJob *job) + return; + } + case PreviewJobPrivate::STATE_CREATETHUMB: { +- if (!d->tempName.isEmpty()) { +- QFile::remove(d->tempName); +- d->tempName.clear(); +- } ++ d->cleanupTempFile(); + d->determineNextFile(); + return; + } +-- +2.13.0 + diff --git a/kde-frameworks/kio/files/kio-5.34.0-previewjob2.patch b/kde-frameworks/kio/files/kio-5.34.0-previewjob2.patch new file mode 100644 index 000000000000..fab4d8825f4d --- /dev/null +++ b/kde-frameworks/kio/files/kio-5.34.0-previewjob2.patch @@ -0,0 +1,35 @@ +From 1620032772465be475ae0746aff63a566ef2a546 Mon Sep 17 00:00:00 2001 +From: David Faure <faure@kde.org> +Date: Sun, 14 May 2017 15:48:33 +0200 +Subject: [PATCH 2/2] PreviewJob: skip remote directories. Too expensive to + preview. + +For some protocols, file_copy() would end up copying the whole +directory locally! + +FIXED-IN: 5.35 +BUG: 208625 +--- + src/widgets/previewjob.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/widgets/previewjob.cpp b/src/widgets/previewjob.cpp +index e836f7da..da50b219 100644 +--- a/src/widgets/previewjob.cpp ++++ b/src/widgets/previewjob.cpp +@@ -599,6 +599,12 @@ void PreviewJobPrivate::getOrCreateThumbnail() + createThumbnail(fileUrl.toString()); + return; + } ++ if (item.isDir()) { ++ // Skip remote dirs (bug 208625) ++ cleanupTempFile(); ++ determineNextFile(); ++ return; ++ } + // No plugin support access to this remote content, copy the file + // to the local machine, then create the thumbnail + state = PreviewJobPrivate::STATE_GETORIG; +-- +2.13.0 + |