Reputation: 4459
I am developing under ubuntu 16.04. The issue I run into is: I want to detect whether the user has already started the application, if yes, it exits directly.
I have tried using QLocalServer
, QSharedMemory
to achieve that.
But the problem is:
If the program crash without properly close the local server or destroy the shared memory, the local socket/shared memory will remain in the OS and prevent the user to launch the program again.
How to deal with this?
Upvotes: 1
Views: 507
Reputation: 8311
For the shared memory issue you could take a look at this question QSharedMemory is not getting deleted on Application crash
For a more generic answer about having a single instance of an application, you can take a look at Qt Single Application which is part of qt-solutions
Upvotes: 2