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

NVDA crashes when collecting text in Chunks from its edit controls #11613

Closed
lukaszgo1 opened this issue Sep 16, 2020 · 9 comments · Fixed by #12253
Closed

NVDA crashes when collecting text in Chunks from its edit controls #11613

lukaszgo1 opened this issue Sep 16, 2020 · 9 comments · Fixed by #12253
Assignees
Milestone

Comments

@lukaszgo1
Copy link
Contributor

Steps to reproduce:

  1. Open log viewer.
  2. Move navigator object into it with NVDA+numpad minus.
  3. Open Python console with NVDA+Ctrl+z
  4. In the Python console enter:
logViewerTI = nav.makeTextInfo(textInfos.POSITION_ALL)
textInLines = tuple(logViewerTI.getTextInChunks(textInfos.UNIT_LINE))

Actual behavior:

NVDA crashes with the following entry in the log:

DEBUGWARNING - watchdog._watcher (14:18:44.970) - watchdog (5408):
Trying to recover from freeze. Listing stacks for Python threads:
Python stack for thread 3340 (watchdog.CancellableCallThread.execute(<CFunctionType object at 0x03F6B738>)):
File "threading.pyc", line 890, in _bootstrap
File "threading.pyc", line 926, in _bootstrap_inner
File "watchdog.pyc", line 332, in run
File "threading.pyc", line 552, in wait
File "threading.pyc", line 296, in wait

Python stack for thread 5408 (watchdog):
File "threading.pyc", line 890, in _bootstrap
File "threading.pyc", line 926, in _bootstrap_inner
File "threading.pyc", line 870, in run
File "watchdog.pyc", line 127, in _watcher
File "watchdog.pyc", line 63, in getFormattedStacksForAllThreads

Python stack for thread 5336 (winInputHook):
File "threading.pyc", line 890, in _bootstrap
File "threading.pyc", line 926, in _bootstrap_inner
File "threading.pyc", line 870, in run
File "winInputHook.pyc", line 79, in hookThreadFunc

Python stack for thread 6024 (_UIAHandler.UIAHandler.MTAThread):
File "threading.pyc", line 890, in _bootstrap
File "threading.pyc", line 926, in _bootstrap_inner
File "threading.pyc", line 870, in run
File "_UIAHandler.pyc", line 310, in MTAThreadFunc
File "queue.pyc", line 170, in get
File "threading.pyc", line 296, in wait

Python stack for thread 5832 (braille._BgThread):
File "threading.pyc", line 890, in _bootstrap
File "threading.pyc", line 926, in _bootstrap_inner
File "threading.pyc", line 870, in run
File "braille.pyc", line 2187, in func

Python stack for thread 6044 (synthDrivers._espeak.BgThread):
File "threading.pyc", line 890, in _bootstrap
File "threading.pyc", line 926, in _bootstrap_inner
File "synthDrivers_espeak.pyc", line 190, in run
File "queue.pyc", line 170, in get
File "threading.pyc", line 296, in wait

Python stack for thread 5904 (MainThread):
File "nvda.pyw", line 215, in
File "core.pyc", line 550, in main
File "wx\core.pyc", line 2134, in MainLoop
File "pythonConsole.pyc", line 386, in onInputChar
File "pythonConsole.pyc", line 274, in execute
File "pythonConsole.pyc", line 135, in push
File "code.pyc", line 258, in push
File "code.pyc", line 74, in runsource
File "code.pyc", line 90, in runcode
File "", line 1, in
File "textInfos_init_.pyc", line 529, in getTextInChunks
File "baseObject.pyc", line 26, in get
File "NVDAObjects\window\edit.pyc", line 748, in get_text
File "NVDAObjects\window\edit.pyc", line 642, in getTextAtRange
File "comtypes_init
.pyc", line 279, in getattr
File "comtypesMonkeyPatches.pyc", line 26, in call
File "comtypes_init
.pyc", line 1010, in del

Expected behavior:

Tuple containing all lines from the log viewer should be returned. NVDA should not crash.

System configuration

NVDA installed/portable/running from source:

Both installed and portable

NVDA version:

NVDA version alpha-20966,0baf0ceb

Windows version:

Windows 7 X64

Name and version of other software in use when reproducing the issue:

None

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

Tested back to 2018.3 and the crash can be reproduced with every version.

If addons are disabled, is your problem still occuring?

Yes

Did you try to run the COM registry fixing tool in NVDA menu / tools?

N/A

@lukaszgo1
Copy link
Contributor Author

cc @michaelDCurran It seems NVDA crashes when making a COM call and you've recently fixed various crashes of that sort.

@LeonarddeR
Copy link
Collaborator

This crash can be explained by the generator being infinite. It looks like it yields the bottom line over and over again.

@feerrenrut feerrenrut added this to the 2020.4 milestone Nov 26, 2020
@feerrenrut
Copy link
Contributor

I think we should investigate this at least before 2020.4

@CyrilleB79
Copy link
Collaborator

This crash can be explained by the generator being infinite. It looks like it yields the bottom line over and over again.

Yes because:
In NVDAObjects\window\edit.py, ITextDocumentTextInfo.collapse(end=True) does not collapse at the end of the range but one character before.
It seems that ITextDocument.SetRange cannot set the range with both ends at the end of the edit field. in this case.

@lukaszgo1
Copy link
Contributor Author

@CyrilleB79 Thanks for the investigation. I believe there are two issues at play here:

  • The generator being infinite makes it impossible to retrieve text of the edit control in chunks. This is obviously quite bad, but in all other rich edit controls i.e. WordPad Qread, attempting to collect text results in CallCancelled being raised
  • When collecting text for NVDA's controls however NVDA simply crashes - this suggests to me that it is unable to cope with the CallCancelled being raised

@feerrenrut
Copy link
Contributor

Can you describe a real world situation where a user may encounter this? Or is this relevant to an addon?

@lukaszgo1
Copy link
Contributor Author

I've discovered this only because my Percentage Checker add-on has a function which allows to jump to a given line number in a text field and one of users reported to me that when trying to use it in NVDA's edit fields NVDA crashes. I consider impact to be pretty low, though fixing it at some point would certainly be nice.

@feerrenrut
Copy link
Contributor

Ok, thanks @lukaszgo1, we won't hold up 2020.4. But as you said, it would be good to fix this.

@feerrenrut feerrenrut modified the milestones: 2020.4, 2021.1 Dec 15, 2020
@feerrenrut
Copy link
Contributor

I can reproduce this myself, I can confirm that I had to manually kill NVDA in order to un-freeze my system, I had no response from NVDA at all. I had to use task manager to kill NVDA.

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