[Libreoffice-commits] core.git: winaccessibility/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Sat Sep 18 07:07:28 UTC 2021
winaccessibility/source/UAccCOM/MAccessible.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 1b94deea2c7648255e3efac08fd352f80c2bda06
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Sep 17 16:12:25 2021 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Sep 18 09:06:54 2021 +0200
tdf#100086 wina11y: Return "fresh" IEnumVARIANT for get_accSelection
Create a clone and reset the IEnumVariant returned
in 'CMAccessible::get_accSelection'
when multiple children are selected.
It seems reasonable to assume that an 'IEnumVARIANT'
retrieved by calling the 'IAccessible::get_accSelection' [1]
method to get access to the selected children will
start enumerating selected children at the beginning,
not where enumeration left off with any previously
retrieved 'IEnumVARIANT'.
I came across this because a pending NVDA pull request
to implement the announcement of multiple selected Calc cells
mentions that "accSelection is broken in LibreOffice" [2].
NVDA uses 'IAccessible::get_accSelection' and then
'IEnumVARIANT::Next' to get the amount of currently
selected cells.
However, with the same underlying 'CMAccessible' object
being used in subsequent attempts to retrieve the count
of selected children and its 'm_lCurrent' member not
being reset in between, this effectively meant that children
considered when retrieving the selection the previous time
were considered as "already having been taken into account"
when (not) looping over the children to return in
'CEnumVariant::Next'.
[1] https://docs.microsoft.com/en-us/windows/win32/api/oleacc/nf-oleacc-iaccessible-get_accselection
[2] https://github.com/nvaccess/nvda/pull/12849/commits/b9f7ee1c2a8cbb9415545dc2562901881e27f11f
Change-Id: I8e6b8bffaab010a0cfa7db8d43807e7520673d45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122268
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 325cd00e2a62..2d62ec494bc7 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -864,8 +864,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accSelection(VARIANT *pvarCh
break;
default:
pvarChildren->vt = VT_UNKNOWN;
- m_pEnumVar->AddRef();
- pvarChildren->punkVal = m_pEnumVar;
+ IEnumVARIANT* pClone;
+ m_pEnumVar->Clone(&pClone);
+ pClone->Reset();
+ pvarChildren->punkVal = pClone;
break;
}
return S_OK;
More information about the Libreoffice-commits
mailing list