fix #171,use lock file instead of QSharedMemory

-- this way the lock is per user and crashing Latte
allows us to rerun it properly
v0.6
Michail Vourlakos 8 years ago
parent 0692521fd4
commit a34adf5990

@ -29,6 +29,8 @@
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QDebug>
#include <QDir>
#include <QLockFile>
#include <QSharedMemory>
#include <KLocalizedString>
@ -54,13 +56,12 @@ void noMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
int main(int argc, char **argv)
{
QSharedMemory sharedMemory;
sharedMemory.setKey("latte-dock");
QString tmpDir = QDir::tempPath();
QLockFile lockFile(tmpDir + "/latte-dock.lock");
if (!sharedMemory.create(1)) {
if (!lockFile.tryLock(100)) {
qDebug() << i18n("Warning: An instance of Latte application is already running!!!");
exit(0); // Exit, already a process running
exit(0);
}
// Devive pixel ratio has some problems in latte (plasmashell) currently.

Loading…
Cancel
Save