Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue audacity#5357: Change of format of a duration in a generator ca…
…n cause crash With a screen reader running, in one of the the built in generators, for example chirp, changing the format of the duration can crash Audacity. Problem: NumericTextCtrlAx::GetName(), uses NumericTextCtrl::GetFocusedField() to get the focused field. It then uses that as in index for a vector. However, NumericTextCtrl::UpdateAutoFocus() does not update the value of mLastField, which is returned by NumericTextCtrl::GetFocusedField(). So after a change of format, GetFocusedField() can return a value which does not exist in the new format. This can cause Audacity to crash. This happens from Audacity 3.3.0, and I don't know why it didn't in versions before this. Possible fixes: 1. Change NumericTextCtrl::UpdateAutoFocus() so that it updates mLastField. 2. Given that NumericTextCtrl::GetFocusedField() is only used by the accessibility object, and that the focused field can be derived for NumericTextCtrl::GetFocusedDigit(), remove NumericTextCtrl::GetFocusedField() and NumericTextCtrl::mLastField. The second fix was implemented, as it will reduce the chance of errors in this area in the future.
- Loading branch information