path: root/accessibility/inc
diff options
authorMichael Stahl <>2019-09-18 15:54:23 +0200
committerMichael Stahl <>2019-09-18 18:09:21 +0200
commit77ea0535271d3fb3d49c8d916ecf80e0a7f70653 (patch)
tree417e9865ff95997891105b6115f1264063d23173 /accessibility/inc
parent9c78b8a72895831b33731e17ca7f8c825c19827a (diff)
accessibility: fix leak of AccessibleListBoxEntry
The problem is that AccessibleListBoxEntry from the Stylist in the sidebar are not deleted until the document is closed, which causes slowdowns because it causes an ever-growing list of window listeners. There are several issues here: * AccessibleListBoxEntry::m_aParent appears of dubious merit because SvTreeList::Move may move entries to a different parent; this member may or may not be initialised depending on where the instance is created; there are confusing comments mentioning a "Solution" but not the corresponding problem; just remove it and let it do a dynamic lookup when needed * AccessibleListBox::m_mapEntry already exists but is used in only half the places where AccessibleListBoxEntry are created; use it everywhere (consistently create entry without a parent, see previous point), and let AccessibleListBoxEntry know the AccessibleListBox instance so it can use the m_mapEntry too * When VclEventId::ListboxItemRemoved event is received, the m_mapEntry is cleared but the AccessibleListBoxEntry survive this happily; better dispose them (seeing as this event is regularly sent because there's some timer clearing the Stylist and recreating it from scratch...) Change-Id: I6c3336e019e873fa7cc8fa03cb8949a1ff2fe8fa Reviewed-on: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
Diffstat (limited to 'accessibility/inc')
2 files changed, 12 insertions, 9 deletions
diff --git a/accessibility/inc/extended/accessiblelistbox.hxx b/accessibility/inc/extended/accessiblelistbox.hxx
index cb075f299bb6..70248208ec0a 100644
--- a/accessibility/inc/extended/accessiblelistbox.hxx
+++ b/accessibility/inc/extended/accessiblelistbox.hxx
@@ -75,6 +75,8 @@ namespace accessibility
AccessibleListBox( SvTreeListBox const & _rListBox,
const css::uno::Reference< css::accessibility::XAccessible >& _xParent );
+ rtl::Reference<AccessibleListBoxEntry> implGetAccessible(SvTreeListEntry & rEntry);
// XTypeProvider
@@ -108,7 +110,7 @@ namespace accessibility
- typedef std::map< SvTreeListEntry*, css::uno::Reference< css::accessibility::XAccessible > > MAP_ENTRY;
+ typedef std::map<SvTreeListEntry*, rtl::Reference<AccessibleListBoxEntry>> MAP_ENTRY;
MAP_ENTRY m_mapEntry;
css::uno::Reference< css::accessibility::XAccessible > m_xFocusedChild;
diff --git a/accessibility/inc/extended/accessiblelistboxentry.hxx b/accessibility/inc/extended/accessiblelistboxentry.hxx
index 2d9e4fac97b1..babaf08a52b5 100644
--- a/accessibility/inc/extended/accessiblelistboxentry.hxx
+++ b/accessibility/inc/extended/accessiblelistboxentry.hxx
@@ -54,7 +54,7 @@ class SvTreeListEntry;
namespace accessibility
+ class AccessibleListBox;
// class AccessibleListBoxEntry ------------------------------------------
typedef ::cppu::WeakAggComponentImplHelper9< css::accessibility::XAccessible
@@ -84,8 +84,8 @@ namespace accessibility
/// client id in the AccessibleEventNotifier queue
sal_uInt32 m_nClientId;
- css::uno::WeakReference< css::accessibility::XAccessible >
- m_aParent;
+ css::uno::WeakReference<css::accessibility::XAccessible> m_wListBox;
+ AccessibleListBox & m_rListBox;
tools::Rectangle GetBoundingBox_Impl() const;
tools::Rectangle GetBoundingBoxOnScreen_Impl() const;
@@ -121,13 +121,14 @@ namespace accessibility
/** Ctor()
@param _rListBox
the view control
- @param _pEntry
+ @param rEntry
the entry
- @param _xParent
- is our parent accessible object
+ @param rListBox
+ the a11y object for _rListBox
- AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvTreeListEntry* _pEntry,
- const css::uno::Reference< css::accessibility::XAccessible >& _xParent );
+ AccessibleListBoxEntry( SvTreeListBox& _rListBox,
+ SvTreeListEntry& rEntry,
+ AccessibleListBox & rListBox);
SvTreeListEntry* GetSvLBoxEntry() const { return m_pSvLBoxEntry; }