Reported by jteh on 2009-12-10 03:02
Although we do currently try to check for an existing instance of NVDA and prevent multiple instances from starting, we still sometimes end up with multiple instances if several copies are started in very quick succession. This is because the check is based on the GUI window, which is not created instantaneously. Also, checking and creating the window is not an atomic operation. We need to find a better way of preventing multiple instances.
We still need to use the window to detect old versions and also to send WM_QUIT to terminate an existing copy. However, we can use semaphores as an extra protection mechanism. Checking for and creating a semaphore is an atomic operation; creation will fail if it already exists. As soon as creating the semaphore fails, we know there is an existing copy.
Comment 1 by jteh on 2011-02-11 19:06
Accidentally starting multiple instances really is very annoying and ugly. I think we should fix it sooner rather than later.
We can use CreateMutex and check for ERROR_ALREADY_EXISTS to determine if the app is already running. This way, both creation and check are atomic. The mutex name must include the desktop name, as we still want instances on other desktops to run.
This may have some impact on the service, so this needs to be tested.
Milestone changed from None to 2011.2
Comment 2 by mdcurran on 2011-03-30 00:39
Possible fix in 4df32e2. But, this must still be tested with the service on secure desktops, and with fast user switching etc.
Comment 3 by mdcurran on 2011-06-06 01:19
Closing as fixed as so far we have not seen any issues.
This ticket can of course be reopened if in deed issues are noticed later on.