QLockFile: use QCoreApplication::applicationName.
Unlike qAppName, it doesn't require a QCoreApplication instance, making QLockFile usable in destructors of global statics. This also uses the value passed to setApplicationName if called rather than always argv[0]. Change-Id: I40446aba410db42d7cfe6b4408878faf435246f7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0d5ffd67a4
commit
88851fb3b0
@ -137,7 +137,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
// (otherwise we'd have to check every write call)
|
||||
// Use operator% from the fast builder to avoid multiple memory allocations.
|
||||
QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'
|
||||
% qAppName().toUtf8() % '\n'
|
||||
% QCoreApplication::applicationName().toUtf8() % '\n'
|
||||
% localHostName() % '\n';
|
||||
|
||||
const QByteArray lockFileName = QFile::encodeName(fileName);
|
||||
|
@ -94,7 +94,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
QByteArray fileData;
|
||||
fileData += QByteArray::number(QCoreApplication::applicationPid());
|
||||
fileData += '\n';
|
||||
fileData += qAppName().toUtf8();
|
||||
fileData += QCoreApplication::applicationName().toUtf8();
|
||||
fileData += '\n';
|
||||
fileData += localHostName();
|
||||
fileData += '\n';
|
||||
|
Loading…
Reference in New Issue
Block a user