summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qlockfile_unix.cpp2
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp10
2 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 623968b869..bcef84206e 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -136,6 +136,8 @@ static QBasicMutex fcntlLock;
static bool fcntlWorksAfterFlock(const QString &fn)
{
QMutexLocker lock(&fcntlLock);
+ if (fcntlOK.isDestroyed())
+ return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
bool *worksPtr = fcntlOK->object(fn);
if (!worksPtr) {
worksPtr = new bool(QLockFilePrivate::checkFcntlWorksAfterFlock(fn));
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"