Mitigated QSharedMemory initialization failures

Mitigated QSharedMemory initialization failures  due to large amount of processes attempting to get hold of the shared memory block at the same time
This commit is contained in:
Itay Grudev 2020-09-09 02:29:00 +01:00
parent 3e83f5ce13
commit be013eff5c

View File

@ -55,6 +55,10 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
// block and QLocalServer
d->genBlockServerName();
// To mitigate QSharedMemory issues with large amount of processes
// attempting to attach at the same time
d->randomSleep();
#ifdef Q_OS_UNIX
// By explicitly attaching it and then deleting it we make sure that the
// memory is deleted even after the process has crashed on Unix.