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

Already on GitHub? Sign in to your account

NVDA doesn't change the profile after a command line window closes #3732

Closed
nvaccessAuto opened this Issue Dec 24, 2013 · 13 comments

Comments

Projects
None yet
2 participants

Reported by oaron on 2013-12-24 12:31
I've created a profile for command line. When I open a command line window it works well, but when I close it with the "exit" command, NVDA doesn't change the profile, it uses the command line's options.

Comment 1 by briang1 on 2013-12-25 13:40
Hmm, also, if you force it back to the normal one its still using the new one and keeps switching it back. Indeed I changed the voice in the command line window one and it seemed to have changed it for normal as well. Could these, both being parts of the same Windows system be somehow undetectable or what?

Comment 2 by jteh on 2014-01-06 06:41
Confirmed. No idea what's causing it yet.
Changes:
Milestone changed from None to next

Comment 3 by jteh on 2014-01-07 04:28
Technical: The problem is that appModuleHandler.update cleans up dead app modules, but in some cases, it gets called before api.setFocusObject, which is where we get the app modules for the old focus. It is called from IAccessibleHandler when handling events. Theoretically, this could happen for any app, but I guess consoles close fast and fire an event as they do.

I'm not sure of the best solution here. The easiest is probably to split the app module cleanup code into a separate function and call it from api.setFocusObject, just as we did for tree interceptors. We should also consider why we're calling appModuleHandler.update from IAccessibleHandler, as I can't think of a good reason for doing this now.

Comment 5 by jteh on 2014-01-08 11:32
It seems we have another problem as well. Sometimes, we end up with two app modules for the same process. I think this is due to a race condition in appModuleHandler.getAppModuleFromProcessID when it is called from a UIA thread. When it looks for an app module, it doesn't find one, so it creates one, but meanwhile, it was already created in the main thread. I guess we'll need a lock around appModuleHandler.runningTable.

Comment 6 by James Teh <jamie@... on 2014-01-09 00:06
In [5565e24]:

Fix some cases where a profile trigger isn't exited when an application closes.

appModuleHandler.update is called from IAccessibleHandler for all events, but it currently cleans up app modules for dead processes. Sometimes, an event is fired before we fetch the old app modules in api.setFocusObject, so by that point, the app module is gone and we can't exit the trigger.
To fix this, split the cleanup code into a separate function and call it only after the old app modules have been fetched in setFocusObject.
Re #3732.

Comment 7 by James Teh <jamie@... on 2014-01-09 00:06
In [ab2738a]:

Fix more cases where a profile trigger isn't exited when an application closes.

This occurred because there were sometimes two app modules for the same process, so the profile was being triggered twice. The first instance died before the process exited, so one of the triggers wasn't exited.
The root cause was that app modules can be fetched in UIA event threads, but there was a race condition in getAppModuleFromProcessID where two app modules could be created if two threads were fetching for the same process ID at around the same time.
Fix this using a lock.
Re #3732.

Comment 8 by James Teh <jamie@... on 2014-01-09 00:07
In [a85f122]:

Merge branch 't3732' into next

Incubates #3732.

Changes:
Added labels: incubating

Comment 9 by briang1 on 2014-01-12 09:37
Well so far its working. the only issue I've had in XP is that for some weird reason, if Speech hub is one of the synths, opening the synth dialogue to change the synth in a profile can generate multiple erros. Once again, this is most likely to occur the very first time, and thereafter its fine. Note that in the log below, I'm not actually attempting to use Speech hub, just change to microsoft speech platform from Espeak in the command prompt profile already created. This could be a bug in Speech hub, I do not know.

IO - speech.speak (09:06:20):
Speaking ('en_GB'), u'Synthesizer... s 2 of 14'
IO - inputCore.InputManager.executeGesture (09:06:23):
Input: kb(desktop):enter
DEBUGWARNING - Python warning (09:06:23):
c:\progra~1\nvda\library.zip\gui\settingsDialogs.py:60: DeprecationWarning: object() takes no parameters
DEBUG - external:synthDrivers.sh_espeak.log (09:06:23):
Loading speechhub espeak
INFO - external:synthDrivers.sh_espeak.log (09:06:23):
generating scripts
DEBUG - external:synthDrivers.sh_genscripts.log (09:06:23):
Trying to connect
DEBUGWARNING - watchdog.watcher (09:06:23):
Trying to recover from freeze, core stack:
File "nvda.pyw", line 165, in
File "core.pyc", line 316, in main
File "wx_core.pyc", line 8010, in MainLoop
File "wx_core.pyc", line 7306, in MainLoop
File "wx_core.pyc", line 14669, in
File "gui__init
.pyc", line 146, in showGui
File "gui__init__.pyc", line 474, in onActivate
File "wx_windows.pyc", line 2190, in PopupMenu
File "gui__init__.pyc", line 211, in onSynthesizerCommand
File "gui__init__.pyc", line 176, in _popupSettingsDialog
File "gui\settingsDialogs.pyc", line 72, in init
File "gui\settingsDialogs.pyc", line 293, in makeSettings
File "synthDriverHandler.pyc", line 51, in getSynthList
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\sh_espeak.py", line 60, in check
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_sh_genscripts.py", line 74, in genEngineScripts
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_sh_genscripts.py", line 57, in getSynthSettings
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 103, in SpeechHub
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 201, in startServer
File "socket.pyc", line 224, in meth

INFO - external:synthDrivers._sh_genscripts.log (09:06:24):
Spawning speech-hub with C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\SpeechHub_SpeechServer.bat
ERROR - synthDriverHandler.getSynthList (09:06:24):
Traceback (most recent call last):
File "synthDriverHandler.pyc", line 51, in getSynthList
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\sh_espeak.py", line 60, in check
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_sh_genscripts.py", line 74, in genEngineScripts
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_sh_genscripts.py", line 57, in getSynthSettings
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 103, in SpeechHub
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 205, in startServer
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 166, in spawnServer
File "subprocess.pyc", line 703, in init
File "subprocess.pyc", line 839, in _get_handles
File "subprocess.pyc", line 878, in _make_inheritable
WindowsError: 6 The handle is invalid
DEBUG - external:synthDrivers.sh_marytts.log (09:06:24):
Loading speechhub marytts
DEBUGWARNING - external:synthDrivers.sh_marytts.log (09:06:24):
Checked that speechhub marytts is up
DEBUG - external:synthDrivers._sh_genscripts.log (09:06:24):
Using existing SpeechHub connection
ERROR - synthDriverHandler.getSynthList (09:06:24):
Traceback (most recent call last):
File "synthDriverHandler.pyc", line 51, in getSynthList
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\sh_marytts.py", line 61, in check
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 333, in listOutputModules
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 144, in writeline
AttributeError: SpeechHubClass instance has no attribute 'processingMessageLock'
DEBUG - external:synthDrivers.sh_msp.log (09:06:24):
Loading speechhub msp
DEBUGWARNING - external:synthDrivers.sh_msp.log (09:06:24):
Checked that speechhub msp is up
DEBUG - external:synthDrivers._sh_genscripts.log (09:06:24):
Using existing SpeechHub connection
ERROR - synthDriverHandler.getSynthList (09:06:24):
Traceback (most recent call last):
File "synthDriverHandler.pyc", line 51, in getSynthList
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\sh_msp.py", line 62, in check
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 333, in listOutputModules
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 144, in writeline
AttributeError: SpeechHubClass instance has no attribute 'processingMessageLock'
DEBUG - external:synthDrivers.sh_picotts.log (09:06:24):
Loading speechhub picotts
DEBUGWARNING - external:synthDrivers.sh_picotts.log (09:06:24):
Checked that speechhub picotts is up
DEBUG - external:synthDrivers._sh_genscripts.log (09:06:24):
Using existing SpeechHub connection
ERROR - synthDriverHandler.getSynthList (09:06:24):
Traceback (most recent call last):
File "synthDriverHandler.pyc", line 51, in getSynthList
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\sh_picotts.py", line 61, in check
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 333, in listOutputModules
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 144, in writeline
AttributeError: SpeechHubClass instance has no attribute 'processingMessageLock'
DEBUG - external:synthDrivers.sh_sapi5.log (09:06:24):
Loading speechhub sapi5
DEBUGWARNING - external:synthDrivers.sh_sapi5.log (09:06:24):
Checked that speechhub sapi5 is up
DEBUG - external:synthDrivers._sh_genscripts.log (09:06:24):
Using existing SpeechHub connection
ERROR - synthDriverHandler.getSynthList (09:06:24):
Traceback (most recent call last):
File "synthDriverHandler.pyc", line 51, in getSynthList
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers\sh_sapi5.py", line 62, in check
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 333, in listOutputModules
File "C:\Documents and Settings\brian\Application Data\nvda\addons\Speech Hub\synthDrivers_speechhub.py", line 144, in writeline
AttributeError: SpeechHubClass instance has no attribute 'processingMessageLock'
DEBUGWARNING - synthDriverHandler.getSynthList (09:06:24):
Synthesizer 'audiologic' doesn't pass the check, excluding from list
DEBUGWARNING - synthDriverHandler.getSynthList (09:06:24):
Synthesizer 'newfon' doesn't pass the check, excluding from list
IO - speech.speak (09:06:24):
Speaking ('en_GB'), u'Synthesizer dialog'
IO - speech.speak (09:06:24):
Speaking ('en_GB'), u'Synthesizer: combo box eSpeak collapsed Alt+s'
IO - inputCore.InputManager.executeGesture (09:06:41):
Input: kb(desktop):downArrow
IO - speech.speak (09:06:41):
Speaking ('en_GB'), u'Microsoft Speech Platform'
IO - inputCore.InputManager.executeGesture (09:06:43):
Input: kb(desktop):enter
WARNING - stdout (09:06:43):

Generating comtypes.gen._D3C4A7F2_7D27_4332_B41F_593D71E16DB1_0_11_0

DEBUG - speechDictHandler.SpeechDict.load (09:06:45):
Loading speech dictionary 'C:\Documents and Settings\brian\Application Data\nvda\speechDicts\mssp-Microsoft Server Speech Text to Speech Voice (en-GB, Hazel).dic'...
DEBUG - speechDictHandler.SpeechDict.load (09:06:45):
10 loaded records.
INFO - synthDriverHandler.setSynth (09:06:45):
Loaded synthDriver mssp
IO - speech.speak (09:06:45):
Speaking ('en_GB'), u'Command Prompt terminal'
DEBUGWARNING - synthDrivers.sapi5.SynthDriver.speak (09:06:45):
Unsupported speech command: LangChangeCommand ('en_GB')
IO - speech.speak (09:06:46):
Speaking ('en_GB'), u'C:\Documents and Settings\brian> '
DEBUGWARNING - synthDrivers.sapi5.SynthDriver.speak (09:06:46):
Unsupported speech command: LangChangeCommand ('en_GB')
IO - inputCore.InputManager.executeGesture (09:07:02):
Input: kb(desktop):windows+m
INFO - synthDrivers.espeak.SynthDriver.init (09:07:02):
Using eSpeak version 1.47.11 03.May.13
DEBUG - speechDictHandler.SpeechDict.load (09:07:02):
Loading speech dictionary 'C:\Documents and Settings\brian\Application Data\nvda\speechDicts\espeak-english.dic'...
DEBUG - speechDictHandler.SpeechDict.load (09:07:02):
2 loaded records.
INFO - synthDriverHandler.setSynth (09:07:02):
Loaded synthDriver espeak
IO - speech.speak (09:07:02):
Speaking ('en_GB'), u'Desktop list'
IO - speech.speak (09:07:02):
Speaking ('en_GB'), u'Command Prompt 39 of 76'
IO - inputCore.InputManager.executeGesture (09:07:07):
Input: kb(desktop):alt+tab
IO - speech.speak (09:07:07):
Speaking ('en_GB'), u'nvda messages - Outlook Express - Brian Gaff sofa icon 1 of 2'
IO - speech.speak (09:07:07):
Speaking ('en_GB'), u'nvda messages - Outlook Express - Brian Gaff sofa'
IO - speech.speak (09:07:07):
Speaking ('en_GB'), u'Outlook Express Message List list'
IO - speech.speak (09:07:07):
Speaking [('en_GB'), u"From: NVDA Trac; Subject: Re: NVDA #3732: NVDA doesn't change the profile after a command line window closes; Received: 09/01/2014 00:07 2751 of 2751"]
IO - inputCore.InputManager.executeGesture (09:07:09):
Input: kb(desktop):alt+tab
IO - speech.speak (09:07:09):
Speaking ('en_GB'), u'Command Prompt icon 2 of 2'
DEBUG - speechDictHandler.SpeechDict.load (09:07:10):
Loading speech dictionary 'C:\Documents and Settings\brian\Application Data\nvda\speechDicts\mssp-Microsoft Server Speech Text to Speech Voice (en-GB, Hazel).dic'...
DEBUG - speechDictHandler.SpeechDict.load (09:07:10):
10 loaded records.
INFO - synthDriverHandler.setSynth (09:07:10):
Loaded synthDriver mssp
IO - speech.speak (09:07:10):
Speaking ('en_GB'), u'Command Prompt terminal'

As I say, this is probably unconnected, and seems not to always occur.

Comment 10 by jteh on 2014-01-12 10:03
I can't see how this would be related. I think you'll be able to reproduce this in master as well eventually. However, keep us posted if you find reason to suspect otherwise.

Comment 11 by briang1 on 2014-01-12 10:53
Ah, just downloaded latest master and installed it with the same result. so is this speech hub or nvda causing the issue?

Comment 12 by briang1 on 2014-01-12 12:17
I think I have traced this error to speech hub.
I merely uninstalled and removed the add on, then reinstalled it again. Its the same version but I suspect it had got itself corrupted in some way.

Comment 13 by James Teh <jamie@... on 2014-01-30 06:27
In [df9585c]:

When a configuration profile is triggered for an application and that application is exited, NVDA no longer sometimes fails to deactivate the profile.

Fixes #3732.

Changes:
Removed labels: incubating
State: closed

Comment 14 by jteh on 2014-01-30 07:12
Changes:
Milestone changed from next to 2014.1

@nvaccessAuto nvaccessAuto added the bug label Nov 10, 2015

@nvaccessAuto nvaccessAuto added this to the 2014.1 milestone Nov 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment