diff options
author | Ingo Klöcker <[email protected]> | 2023-11-15 10:51:51 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2023-11-15 10:57:18 +0000 |
commit | 278f92b189ece58dee2036450ac029e3599fdb1f (patch) | |
tree | 247edf5f04f2a0427546405f98fb25894aa9c7c9 /lang/qt/src/util.cpp | |
parent | doc: Fix for e.g. and i.e. (diff) | |
download | gpgme-278f92b189ece58dee2036450ac029e3599fdb1f.tar.gz gpgme-278f92b189ece58dee2036450ac029e3599fdb1f.zip |
qt: Remove left-over partial files more persistently
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/cleaner.cpp, lang/qt/src/cleaner.h: New.
* lang/qt/src/util.cpp (PartialFileGuard::~PartialFileGuard): Call
Cleaner::removeFile instead of removeFile.
* lang/qt/src/util.cpp, lang/qt/src/util.h (removeFile): Remove.
--
If the initial attempt to remove the file fails then a Cleaner is
created that tries to remove the file at regular intervals (10 s)
and on destruction (which happens on application shutdown).
GnuPG-bug-id: 6584
Diffstat (limited to 'lang/qt/src/util.cpp')
-rw-r--r-- | lang/qt/src/util.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lang/qt/src/util.cpp b/lang/qt/src/util.cpp index 297c76a6..4b437ffb 100644 --- a/lang/qt/src/util.cpp +++ b/lang/qt/src/util.cpp @@ -37,6 +37,7 @@ #include "util.h" +#include "cleaner.h" #include "qgpgme_debug.h" #include <QFile> @@ -68,17 +69,6 @@ QStringList toFingerprints(const std::vector<GpgME::Key> &keys) return fprs; } -void removeFile(const QString &fileName) -{ - if (QFile::exists(fileName)) { - if (QFile::remove(fileName)) { - qCDebug(QGPGME_LOG) << __func__ << "- Removed file" << fileName; - } else { - qCDebug(QGPGME_LOG) << __func__ << "- Removing file" << fileName << "failed"; - } - } -} - /** * Generates a string of random characters for the file names of temporary files. * Never use this for generating passwords or similar use cases requiring highly @@ -157,7 +147,7 @@ PartialFileGuard::PartialFileGuard(const QString &fileName) PartialFileGuard::~PartialFileGuard() { if (!mTempFileName.isEmpty()) { - removeFile(mTempFileName); + Cleaner::removeFile(mTempFileName); } } |