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

wxAssertion error when closing braille or speech settings panels. #12220

Closed
zstanecic opened this issue Mar 25, 2021 · 13 comments · Fixed by #12363
Closed

wxAssertion error when closing braille or speech settings panels. #12220

zstanecic opened this issue Mar 25, 2021 · 13 comments · Fixed by #12363
Assignees
Labels
Milestone

Comments

@zstanecic
Copy link
Contributor

zstanecic commented Mar 25, 2021

Steps to reproduce:

  1. Open, for example the NVDA voice settings,
  2. try to change something or nothing, it is based on your preferences and taste,
  3. press enter to save, and/or escape to destroy your changes

Actual behavior:

NVDA plays an error sound and produces the following exception, see log

ERROR - unhandled exception (09:33:35.263) - MainThread (7112):
wx._core.wxAssertionError: C++ assertion ""GetWindow() != 0"" failed at ..\..\src\common\wincmn.cpp(3919) in wxWindowAccessible::GetDescription(): 

The above exception was the direct cause of the following exception:
SystemError: <class 'wx._core.WindowDestroyEvent'> returned a result with an error set

Expected behavior:

NVDA should close this dialog without these types of exceptions and errors

System configuration

NVDA installed/portable/running from source:

installed

NVDA version:

NVDA version alpha-22123,8665526b

Windows version:

Using Windows version 10.0.19042 workstation

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

Not applicable

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.

Not applicable

If add-ons are disabled, is your problem still occurring?

Not applicable, NVDA core level

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

Not applicable

@zstanecic
Copy link
Contributor Author

To give you more hints: this issue started to appear after introducing commit which included fetching accessible labels from wx directly.

@XLTechie
Copy link
Collaborator

XLTechie commented Mar 25, 2021 via email

@seanbudd
Copy link
Member

Sounds related to #12219 / #12215

@seanbudd seanbudd added this to the 2021.1 milestone Mar 25, 2021
@feerrenrut feerrenrut self-assigned this Apr 6, 2021
@lukaszgo1
Copy link
Contributor

Is this still reproducible? For me it isn't but I was never able to reproduce this on my system.

@zstanecic
Copy link
Contributor Author

zstanecic commented Apr 9, 2021 via email

@feerrenrut
Copy link
Contributor

I can reproduce this, and I have been investigating.

Here is what I have found

  • Only the braille and speech settings panels have the failure.
  • These both share a common layout. A group (StaticBox), containing a label (StaticText), ExpandoTextCtrl, and Button.
  • In Fix right-to-left layout direction issues #12181, we were advised to make the StaticBox the parent of any controls in the StaticBoxSizer
  • No reproduce if making the SettingsPanel the parent of the ExpandoTextCtrl
  • No reproduce if replacing the ExpandoTextCtrl with TextCtrl. This affects the appearance negatively.
  • No reproduce if explicitly calling destroy on the ExpandoTextCtrl before the rest of the panel is exited.

I have tried to create a minimal test app, however could reproduce the issue.

When attaching VisualStudio Debugger to NVDA, the issue is no longer reproducible.

@feerrenrut
Copy link
Contributor

There doesn't seem to have been many recent changes in wxAccessible in the wxWidgets repo. I suspect that we only now get this assertion because wxPython has enabled accessibility in the build of wxWidgets it includes (and we have recently updated to wxPython 4.1.1) but I have not confirmed this.

wxPython 4.1.1 seems to be using commit 493cc35 of wxWidgets

Debug symbols for Python 3.8-32bit build of wxPython 4.1.1

PR Don't create wxWindowAccessible by default #340 changes the assumptions about wxAccessible, allowing it to return NULL.

PR wxDVC accessibility tweaks #368 which enables building Accessibility features in wxWidgets by default on Windows)

@feerrenrut feerrenrut changed the title When opening any NVDA dialog, then pressing enter or escape to dismiss it, NVDA crashes wxAssertion error when closing braille or speech settings panels. Apr 14, 2021
@feerrenrut feerrenrut added bug and removed bug/crash labels Apr 14, 2021
@feerrenrut
Copy link
Contributor

wxWidgets ticket: https://trac.wxwidgets.org/ticket/19145

@lukaszgo1
Copy link
Contributor

@feerrenrut Would you be able to confirm that this issue goes away when reverting 57e02ca As this commit seems the most logical candidate to me. Perhaps using wx.Accessible would allow to create a MWE for this issue.

@XLTechie
Copy link
Collaborator

XLTechie commented Apr 14, 2021 via email

@XLTechie
Copy link
Collaborator

XLTechie commented Apr 14, 2021 via email

@feerrenrut
Copy link
Contributor

Oh, never mind, I think I see--it breaks RTL.

Yep

Would you be able to confirm that this issue goes away when reverting 57e02ca As this commit seems the most logical candidate to me.

I had confirmed this: Here is the alpha build prior to the introduction of 57e02ca https://ci.appveyor.com/api/buildjobs/gqw4xxr46e67t1yh/artifacts/output%2Fnvda_snapshot_alpha-22114%2Ced5fca6b.exe

I also tested disabling our own accPropServer before 57e02ca was introduced. The problem is reproducible in both cases.

feerrenrut added a commit that referenced this issue Apr 16, 2021
See issue #12220

There was a wxAssertion error when closing braille or speech settings panels.

ERROR - unhandled exception (09:33:35.263) - MainThread (7112):
wx._core.wxAssertionError: C++ assertion ""GetWindow() != 0"" failed at ..\..\src\common\wincmn.cpp(3919) in wxWindowAccessible::GetDescription(): 

The above exception was the direct cause of the following exception:
SystemError: <class 'wx._core.WindowDestroyEvent'> returned a result with an error set

There is a lot more information about the investigation on the issue.

This PR provides a workaround, the true cause of this assertion has not yet been determined.
However in the meantime this PR will prevent the log error, and any additional instability in 
WX that may occur due to ending up in this situation.
@feerrenrut feerrenrut mentioned this issue May 5, 2021
7 tasks
@feerrenrut
Copy link
Contributor

A screenshot of the assertion message:
image

feerrenrut added a commit that referenced this issue May 6, 2021
Fixes: #12336
Fixes: #12220

# Summary of the issue:
Issue#12220 Causes a wx assertion message when either the Braille or Speech settings panels are open.
This seems to be related to the expando text control used on both panels.
The assertion is in wx's accessibility code, which has been introduced in our latest upgrade of wxPython.
The PR #12292 attempted to fix this by explicitly destroying the expando text control when closing.
In #12292 it was missed that the onSave callback was also called for the apply button.

# Description of how this pull request fixes the issue:
While looking at adding an explicit close callback for panels, I noticed that Destroy was being called manually during the event handler.
Scheduling a destroy call after the event handler seems to resolve this issue.
As I understand, destroying children explicitly is not required.

While here also:
- Tidy onSave / onApply
- Add type info for 'catIdToInstanceMap' and 'categoryClasses'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants