Skip to content

Commit

Permalink
Work around wxWidgets assertion (PR #12292)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
feerrenrut authored Apr 16, 2021
1 parent 35ceac2 commit 516706d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,9 +1001,17 @@ def onPanelDeactivated(self):
super(SpeechSettingsPanel,self).onPanelDeactivated()

def onDiscard(self):
# Work around wxAssertion error #12220
# Manually destroying the ExpandoTextCtrl when the settings dialog is
# exited prevents the wxAssertion.
self.synthNameCtrl.Destroy()
self.voicePanel.onDiscard()

def onSave(self):
# Work around wxAssertion error #12220
# Manually destroying the ExpandoTextCtrl when the settings dialog is
# exited prevents the wxAssertion.
self.synthNameCtrl.Destroy()
self.voicePanel.onSave()

class SynthesizerSelectionDialog(SettingsDialog):
Expand Down Expand Up @@ -3212,9 +3220,17 @@ def onPanelDeactivated(self):
super(BrailleSettingsPanel,self).onPanelDeactivated()

def onDiscard(self):
# Work around wxAssertion error #12220
# Manually destroying the ExpandoTextCtrl when the settings dialog is
# exited prevents the wxAssertion.
self.displayNameCtrl.Destroy()
self.brailleSubPanel.onDiscard()

def onSave(self):
# Work around wxAssertion error #12220
# Manually destroying the ExpandoTextCtrl when the settings dialog is
# exited prevents the wxAssertion.
self.displayNameCtrl.Destroy()
self.brailleSubPanel.onSave()


Expand Down

0 comments on commit 516706d

Please sign in to comment.