Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better prevention of multiple instances #507

Closed
nvaccessAuto opened this issue Jan 1, 2010 · 3 comments
Closed

Better prevention of multiple instances #507

nvaccessAuto opened this issue Jan 1, 2010 · 3 comments
Labels
Milestone

Comments

@nvaccessAuto
Copy link

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.

@nvaccessAuto
Copy link
Author

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.
Changes:
Milestone changed from None to 2011.2

@nvaccessAuto
Copy link
Author

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.

@nvaccessAuto
Copy link
Author

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.
Changes:
State: closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant