Mutexes are cleaned up automatically by the OS when a program quits, even if it quits abnormally.
Here’s an example project that implements as a custom subclass of the Application
class called SingleInstanceApp
. The SingleInstanceApp
class behaves like a normal Application
class except its OpenDocument
event will be raised for both ordinary documents and also those sent over IPC from another instance.
You can copy the SingleInstanceApp
class into your project and then change the App
superclass from Application
to SingleInstanceApp
.