mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-15 20:28:40 -04:00
Avoid tight loop on lock file access failure
This commit is contained in:
@@ -225,8 +225,7 @@ int main(int argc, char *argv[])
|
||||
// disallow multiple instances with same instance key
|
||||
QLockFile instance_lock {temp_dir.absoluteFilePath (a.applicationName () + ".lock")};
|
||||
instance_lock.setStaleLockTime (0);
|
||||
bool lock_ok {false};
|
||||
while (!(lock_ok = instance_lock.tryLock ()))
|
||||
while (!instance_lock.tryLock ())
|
||||
{
|
||||
if (QLockFile::LockFailedError == instance_lock.error ())
|
||||
{
|
||||
@@ -249,6 +248,10 @@ int main(int argc, char *argv[])
|
||||
throw std::runtime_error {"Multiple instances must have unique rig names"};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error {"Failed to access lock file"};
|
||||
}
|
||||
}
|
||||
|
||||
// load UI translations
|
||||
|
||||
Reference in New Issue
Block a user