Skip to content

Allow JAB messages through the Windows message filter before initialising JAB.#10526

Merged
michaelDCurran merged 1 commit into
nvaccess:masterfrom
jcsteh:nvdaStartAfterJavaApp
Nov 21, 2019
Merged

Allow JAB messages through the Windows message filter before initialising JAB.#10526
michaelDCurran merged 1 commit into
nvaccess:masterfrom
jcsteh:nvdaStartAfterJavaApp

Conversation

@jcsteh

@jcsteh jcsteh commented Nov 21, 2019

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #10296.

Summary of the issue:

If you start NVDA after a Java app has already started, the Java app is inaccessible to NVDA.

Description of how this pull request fixes the issue:

Internally, the JAB client dll keeps track of Java VMs. This is done via window messages. If a JAB client dll is initialised after a VM, it needs to learn about existing VMs. It does this by broadcasting a message, which is picked up by Java VMs. VMs in turn send a message back to the client DLL. Previously, we allowed messages through the message filter after initialising the JAB. That meant that messages from existing Java VMs might be rejected if they were received before the function returned. To fix this, we allow messages through the filter before initialising the JAB.

Testing performed:

Started Android Studio.
Without the patch, started a source copy of NVDA as admin and confirmed that Android Studio was inaccessible.
With the patch, ran a source copy of NVDA as admin and confirmed that Android Studio was accessible.

Known issues with pull request:

None known. However, it does surprise me that setting up the filter immediately after initialising was breaking things. I would have thought that we'd need a message pump before messages were blocked, and JAB Windows_run doesn't pump as far as I know. Perhaps the filtering actually happens when the message is queued by the VM and that happens before Windows_run returns.

Change log entry:

Bug fixes:
- Java applications started before NVDA are now accessible without the need to restart the Java app. (#10296)

…sing JAB.

Internally, the JAB client dll keeps track of Java VMs.
This is done via window messages.
If a JAB client dll is initialised after a VM, it needs to learn about existing VMs.
It does this by broadcasting a message, which is picked up by Java VMs.
VMs in turn send a message back to the client DLL.
Previously, we allowed messages through the message filter *after* initialising the JAB.
That meant that messages from existing Java VMs might be rejected if they were received before the function returned.
To fix this, we allow messages through the filter before initialising the JAB.
@jcsteh jcsteh marked this pull request as ready for review November 21, 2019 02:38
@jcsteh

jcsteh commented Nov 21, 2019

Copy link
Copy Markdown
Contributor Author

Confirmed that this works with an installed signed copy as well.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Wow, thanks for looking into this. This approach is way cleaner than my approach.

@michaelDCurran michaelDCurran merged commit 7c471be into nvaccess:master Nov 21, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Nov 21, 2019
michaelDCurran added a commit that referenced this pull request Nov 21, 2019
@jcsteh jcsteh deleted the nvdaStartAfterJavaApp branch November 21, 2019 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Starting NVDA after a Java application requires a restart of the app for NVDA to read the interface

4 participants