Fix race condition allowing to run multiple instances at the same time (closes #286968)

This commit is contained in:
Christophe Dumez
2010-06-09 10:12:15 +00:00
parent 779b2baa74
commit a1aa507bdb
25 changed files with 1717 additions and 157 deletions

View File

@@ -45,6 +45,11 @@
#ifdef Q_WS_WIN
#include <shlobj.h>
#include <windows.h>
const int UNLEN = 256;
#else
#include <unistd.h>
#include <sys/types.h>
#endif
#ifdef Q_WS_MAC
@@ -485,6 +490,19 @@ QString misc::userFriendlyDuration(qlonglong seconds) {
return QString::fromUtf8("");
}
QString misc::getUserIDString() {
QString uid = "0";
#ifdef Q_WS_WIN
char buffer[UNLEN+1] = {0};
DWORD buffer_len = UNLEN + 1;
if (!GetUserNameA(buffer, &buffer_len))
uid = QString(buffer);
#else
uid = QString::number(getuid());
#endif
return uid;
}
QStringList misc::toStringList(const QList<bool> &l) {
QStringList ret;
foreach(const bool &b, l) {