summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-07-21 18:12:14 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-07-21 22:47:44 +0200
commitef9bfcdbc67667f217ea01886ee728f8d1cbeb19 (patch)
tree0814011137f093bc1984cd721c61c2fa44f4ce70
parentb735eba5a80984ca6c291e4265fae5551b11e64e (diff)
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.weghorn@posteo.de>
-rw-r--r--accessibility/source/extended/accessiblelistboxentry.cxx57
1 files changed, 27 insertions, 30 deletions
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
}
}