summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2016-04-03 18:36:52 +0200
committerDavid Faure <david.faure@kdab.com>2016-04-10 07:37:51 +0000
commitb6eea89b67e0d3bb4f8f888fff21257eff0b65a5 (patch)
tree51818a84b2bdc53eabc821f7f7c7ca218b2e0489 /tests
parent8c427e5bdfcb54e19d10646d9ff45674077253c9 (diff)
Fix crash when using QLockFile in a global destructor
(for instance any global object which writes out to a config file in the destructor). If the global cache isn't available anymore, don't use it. Change-Id: I851a6e394d0b073aebf3ffd88b1966d424bfb92e Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index 21c5696d1d..4884c126d4 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -546,5 +546,15 @@ bool tst_QLockFile::overwritePidInLockFile(const QString &filePath, qint64 pid)
return f.write(buf) == buf.size();
}
+struct LockFileUsageInGlobalDtor
+{
+ ~LockFileUsageInGlobalDtor() {
+ QLockFile lockFile(QDir::currentPath() + "/lastlock");
+ QVERIFY(lockFile.lock());
+ QVERIFY(lockFile.isLocked());
+ }
+};
+LockFileUsageInGlobalDtor s_instance;
+
QTEST_MAIN(tst_QLockFile)
#include "tst_qlockfile.moc"