summaryrefslogtreecommitdiff
path: root/winaccessibility
diff options
context:
space:
mode:
Diffstat (limited to 'winaccessibility')
-rw-r--r--winaccessibility/inc/AccDescendantManagerEventListener.hxx3
-rw-r--r--winaccessibility/source/service/AccDescendantManagerEventListener.cxx20
2 files changed, 20 insertions, 3 deletions
diff --git a/winaccessibility/inc/AccDescendantManagerEventListener.hxx b/winaccessibility/inc/AccDescendantManagerEventListener.hxx
index 57ae373ce5f7..73cda0f4eb46 100644
--- a/winaccessibility/inc/AccDescendantManagerEventListener.hxx
+++ b/winaccessibility/inc/AccDescendantManagerEventListener.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <stdio.h>
+#include <vector>
#include "AccComponentEventListener.hxx"
#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
@@ -32,6 +33,8 @@
*/
class AccDescendantManagerEventListener: public AccComponentEventListener
{
+private:
+ std::vector<com::sun::star::accessibility::XAccessible*> m_aUnselectedChildrenForDeletion;
public:
AccDescendantManagerEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
diff --git a/winaccessibility/source/service/AccDescendantManagerEventListener.cxx b/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
index c8fc771ae503..479f045cf6f3 100644
--- a/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
+++ b/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
@@ -183,10 +183,24 @@ bool AccDescendantManagerEventListener::NotifyChildEvent(short nWinEvent,const A
XAccessible* pAcc = xChild.get();
pAgent->NotifyAccEvent(nWinEvent, pAcc);
- if (pAgent->IsStateManageDescendant(m_xAccessible.get())
- && (nWinEvent == UM_EVENT_SELECTION_CHANGED_REMOVE))
+ if (pAgent->IsStateManageDescendant(m_xAccessible.get()))
{
- pAgent->DeleteAccObj( pAcc );
+ if (nWinEvent == UM_EVENT_SELECTION_CHANGED_REMOVE)
+ {
+ // The object has just been sent in a SELECTION_CHANGED_REMOVE event
+ // and accessibility tools may query for the object and call methods on
+ // it as a response to this.
+ // Therefore, don't delete the object yet, but remember it for deletion
+ // once the next event of a different type occurs.
+ m_aUnselectedChildrenForDeletion.push_back(pAcc);
+ }
+ else
+ {
+ // handle any pending deletions for objects previously removed from selection
+ for (XAccessible* pAcc : m_aUnselectedChildrenForDeletion)
+ pAgent->DeleteAccObj(pAcc);
+ m_aUnselectedChildrenForDeletion.clear();
+ }
}
return true;
}