forked from qt-creator/qt-creator
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 dd1c9d1b71
Fixes: QTCREATORBUG-30624
Change-Id: I0c0166239242895e25c7bf05d59a371cd0295758
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
@@ -60,6 +60,7 @@ QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId)
|
|||||||
+ QLatin1Char('/') + socketName
|
+ QLatin1Char('/') + socketName
|
||||||
+ QLatin1String("-lockfile");
|
+ QLatin1String("-lockfile");
|
||||||
lockFile.reset(new QLockFile(lockName));
|
lockFile.reset(new QLockFile(lockName));
|
||||||
|
lockFile->setStaleLockTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtLocalPeer::isClient()
|
bool QtLocalPeer::isClient()
|
||||||
|
Reference in New Issue
Block a user