accessibility/source/extended/accessiblelistboxentry.cxx | 54 ++++++--------- 1 file changed, 24 insertions(+), 30 deletions(-)
New commits: commit 0e3d0612a0942b3627a8dca61a072fc04f59d161 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Jul 21 18:20:25 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jul 21 22:47:53 2023 +0200 a11y: Don't look for grandparent when asked for parent `AccessibleListBoxEntry::implGetParentAccessible` was first retrieving the parent, and then that one's parent, which was failing (and thus returning an empty reference) e.g. for the 2nd level items (like "2nd Reminder") in Writer's AutoText Dialog (Ctrl+F3). This resulted in Orca not announcing any such item when focused with the qt6 VCL plugin in use, because Orca considers the object a zombie due to it reporting an index of -1 in the parent. Since the parent is requested, drop one level of finding the parent (don't look for the grandparent). Also convert an `OSL_ENSURE` to a real assert so this triggers if there are still any remaining issues that need to be addressed. This makes Orca announce the item just fine and the hierarchy now looks good in Accerciser, too. (Orca announces the item's text twice for qt6 now instead of not at all, which matches the behaviour with gtk3 that's using native Gtk widgets.) With the "2nd Reminder" item selected in Accerciser's treeview of the LO a11y hierarchy: Before: In [7]: acc.get_index_in_parent() Out[7]: -1 In [8]: acc.parent In [9]: acc.parent == None Out[9]: True With the fix in place: In [11]: acc.get_index_in_parent() Out[11]: 1 In [12]: acc.parent Out[12]: <Atspi.Accessible object at 0x7f14fa3e2340 (AtspiAccessible at 0x3c09da0)> In [13]: acc.parent.name Out[13]: 'Standard' Change-Id: I2994211368508c74093b73eb8c330aa293411e0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154746 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 63d808b39cd2..de291fe529cb 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -335,10 +335,7 @@ namespace accessibility // get the entry for this shortened access path SvTreeListEntry* pParentEntry = m_pTreeListBox->GetEntryFromPath( aParentPath ); - OSL_ENSURE( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" ); - - if ( pParentEntry ) - pParentEntry = m_pTreeListBox->GetParent(pParentEntry); + assert(pParentEntry && "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!"); if ( pParentEntry ) { uno::Reference<XAccessible> xListBox(m_wListBox); commit ef9bfcdbc67667f217ea01886ee728f8d1cbeb19 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Jul 21 18:12:14 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jul 21 22:47:44 2023 +0200 a11y: Drop obsolete check for empty Reference The default Reference ctor always creates an empty Reference, so checking for that here doesn't make any more sense here since commit 77ea0535271d3fb3d49c8d916ecf80e0a7f70653 Date: Wed Sep 18 15:54:23 2019 +0200 accessibility: fix leak of AccessibleListBoxEntry (`git -w shows it's only the check that was dropped besides adapting indendation accordingly.) Change-Id: I18cda45f8730b0234eed0edf31fc6e0a32b1cb9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154745 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 189cb60d56a8..63d808b39cd2 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -319,36 +319,33 @@ namespace accessibility Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const { Reference< XAccessible > xParent; - if ( !xParent.is() ) - { - assert( m_aEntryPath.size() ); // invalid path - if ( m_aEntryPath.size() == 1 ) - { // we're a top level entry - // -> our parent is the tree listbox itself - if ( m_pTreeListBox ) - xParent = m_pTreeListBox->GetAccessible( ); - } - else - { // we have an entry as parent -> get its accessible - - // shorten our access path by one - std::deque< sal_Int32 > aParentPath( m_aEntryPath ); - aParentPath.pop_back(); - - // get the entry for this shortened access path - SvTreeListEntry* pParentEntry = m_pTreeListBox->GetEntryFromPath( aParentPath ); - OSL_ENSURE( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" ); - - if ( pParentEntry ) - pParentEntry = m_pTreeListBox->GetParent(pParentEntry); - if ( pParentEntry ) - { - uno::Reference<XAccessible> xListBox(m_wListBox); - assert(xListBox.is()); - return m_rListBox.implGetAccessible(*pParentEntry); - // the AccessibleListBoxEntry class will create its parent - // when needed - } + assert( m_aEntryPath.size() ); // invalid path + if ( m_aEntryPath.size() == 1 ) + { // we're a top level entry + // -> our parent is the tree listbox itself + if ( m_pTreeListBox ) + xParent = m_pTreeListBox->GetAccessible( ); + } + else + { // we have an entry as parent -> get its accessible + + // shorten our access path by one + std::deque< sal_Int32 > aParentPath( m_aEntryPath ); + aParentPath.pop_back(); + + // get the entry for this shortened access path + SvTreeListEntry* pParentEntry = m_pTreeListBox->GetEntryFromPath( aParentPath ); + OSL_ENSURE( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" ); + + if ( pParentEntry ) + pParentEntry = m_pTreeListBox->GetParent(pParentEntry); + if ( pParentEntry ) + { + uno::Reference<XAccessible> xListBox(m_wListBox); + assert(xListBox.is()); + return m_rListBox.implGetAccessible(*pParentEntry); + // the AccessibleListBoxEntry class will create its parent + // when needed } }