mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
Avoid tight loop on lock file access failure
This commit is contained in:
parent
dacd534284
commit
f31a4efbee
7
main.cpp
7
main.cpp
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user