[Interest] single application
Duane
duane.hebert at group-upc.com
Mon Apr 8 16:11:57 CEST 2013
I have an application that runs on both Windows and Linux. To prevent
multiple instances, we are using QSingleApplication. On Windows, if the
app is started from the desktop this works fine but if it's started from
a console a second instance can be started.
So I've decided to try a suggestion using QSharedMemory. I create an
instance of QSharedMemory with a unique key in main. Then if I can call
create() and it succeeds there is only one app running. This works fine
in windows. It works fine in Linux as long as the running app doesn't
crash. Then the shared memory object is not released and no future
instances can be created until a reboot. This is described in the help
for QSharedMemory.
I would like to use the same method for both OS and also, we expect to
go to Qt 5 and QSingleApplication, QServices etc don't seem to be supported.
Is there some cross platform way to achieve this and one that will be
supported by Qt5?
More information about the Interest
mailing list