summaryrefslogtreecommitdiff
path: root/winaccessibility
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2021-09-17 16:12:25 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2021-09-18 09:06:54 +0200
commit1b94deea2c7648255e3efac08fd352f80c2bda06 (patch)
tree40588424ce5700ff5aac7ac581f62fd7b066ca80 /winaccessibility
parentd596eb99c887b52ab99c38665cf1cacbcd24b029 (diff)
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@posteo.de>
Diffstat (limited to 'winaccessibility')
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx6
1 files changed, 4 insertions, 2 deletions
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;