From 7a8c7a9d0b891dbb3fbe88f4738d7ae147c4400a Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 7 Nov 2018 16:02:07 +0100 Subject: [PATCH] make sure that only one instance of the application runs --- src/gui/kima2.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/kima2.cpp b/src/gui/kima2.cpp index f286e66..3f4a259 100644 --- a/src/gui/kima2.cpp +++ b/src/gui/kima2.cpp @@ -7,6 +7,7 @@ #include #include #include +#include int main(int argc, char* argv[]) { @@ -16,6 +17,13 @@ int main(int argc, char* argv[]) QCoreApplication::setOrganizationDomain("rustysoft.de"); QCoreApplication::setApplicationName("kima2"); + // Make sure that only one instance of the application runs + // Of course the uuid used here is unique to this application + QSharedMemory shared("26297455-946a-4607-bfb7-5025a5f1e136"); + if (!shared.create(512, QSharedMemory::ReadWrite)) { + exit(0); + } + QTranslator qTranslator; QLocale german(QLocale::German); #ifdef __linux__