From d2cb8f0ccb9b84dee2c737693e1a8348a571c986 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 24 May 2024 20:09:46 +0200 Subject: [PATCH] QtSingleApplication: Fix unreliable '-client' option QLockFile documention states: When protecting a resource over a long time, however, the application should always call setStaleLockTime(0ms) and then tryLock() with a short timeout. Without the 0ms stale lock time the new Qt Creator instance would think that the lockfile is stale and starts a new instance! Amends dd1c9d1b71861563abb3fd4be11dc0cc91223b99 Fixes: QTCREATORBUG-30624 Change-Id: I0c0166239242895e25c7bf05d59a371cd0295758 Reviewed-by: Friedemann Kleint --- src/shared/qtsingleapplication/qtlocalpeer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/qtsingleapplication/qtlocalpeer.cpp b/src/shared/qtsingleapplication/qtlocalpeer.cpp index 47dd3805bad..4bbdab4abaa 100644 --- a/src/shared/qtsingleapplication/qtlocalpeer.cpp +++ b/src/shared/qtsingleapplication/qtlocalpeer.cpp @@ -60,6 +60,7 @@ QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId) + QLatin1Char('/') + socketName + QLatin1String("-lockfile"); lockFile.reset(new QLockFile(lockName)); + lockFile->setStaleLockTime(0); } bool QtLocalPeer::isClient()