From f8fc82019d620365da240595eb0bd83fac06ae14 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Wed, 10 Aug 2016 00:03:56 +0100 Subject: [PATCH] Invert logic of CAtomicFile destructor: abandon changes if destruction is due to an exception, instead of applying changes if destruction is NOT due to an exception. Because otherwise QFile destructor will apply changes regardless, by calling the close method via virtual dispatch. --- src/blackmisc/atomicfile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blackmisc/atomicfile.h b/src/blackmisc/atomicfile.h index c83cd3502..f9771f9cb 100644 --- a/src/blackmisc/atomicfile.h +++ b/src/blackmisc/atomicfile.h @@ -35,7 +35,7 @@ namespace BlackMisc CAtomicFile(const QString &filename) : QFile(filename) {} //! \copydoc QFile::~QFile - ~CAtomicFile() { if (! std::uncaught_exception()) { close(); } } + ~CAtomicFile() { if (std::uncaught_exception()) { QFile::close(); } } //! \copydoc QFile::open //! Just before opening the file, the filename is changed so we actually write to a temporary file.