winaccessibility/inc/AccObject.hxx | 2 -- winaccessibility/source/UAccCOM/UAccCOM.cxx | 5 +++-- winaccessibility/source/UAccCOM/acccommon.h | 2 ++ winaccessibility/source/service/AccObject.cxx | 22 +++++----------------- 4 files changed, 10 insertions(+), 21 deletions(-)
New commits: commit ad1e6a99fc3b258b5c8d0ed99a82cdccd8eaae4e Author: Michael Weghorn <[email protected]> AuthorDate: Wed Aug 21 09:01:27 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Aug 21 18:48:54 2024 +0200 wina11y: Consistently assert COM obj creation succeeds The `AccObject` ctor already has an assert that creating the COM object succeeded, so be consistent and drop additional checks still handling the theoretical case that it might have failed for some reason. (Running out of memory could be one, but we don't handle that case in other places that construct simple objects, e.g. using the `new` expression, either.) Change-Id: Ic71ca8a256f1e224f0050c2ee9b039d8823e577a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172179 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/winaccessibility/source/UAccCOM/UAccCOM.cxx b/winaccessibility/source/UAccCOM/UAccCOM.cxx index 2914e16c36f7..68b0d040b114 100644 --- a/winaccessibility/source/UAccCOM/UAccCOM.cxx +++ b/winaccessibility/source/UAccCOM/UAccCOM.cxx @@ -102,8 +102,9 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) IMAccessible* UAccCOMCreateInstance() { IMAccessible* pIMA = nullptr; - HRESULT hr = createInstance<CMAccessible>(IID_IMAccessible, &pIMA); - return (S_OK == hr) ? pIMA : nullptr; + createInstance<CMAccessible>(IID_IMAccessible, &pIMA); + assert(pIMA); + return pIMA; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index 99b05f2e2df2..bd06d941c37f 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -270,12 +270,10 @@ AccObject::AccObject(XAccessible* pAcc, AccObjectWinManager* pManager, m_xAccContextRef = m_xAccRef->getAccessibleContext(); m_xAccActionRef.set(m_xAccContextRef,UNO_QUERY); m_accRole = m_xAccContextRef -> getAccessibleRole(); - if( m_pIMAcc ) - { - m_pIMAcc->SetXAccessible(reinterpret_cast<hyper>(m_xAccRef.get())); - m_pIMAcc->Put_XAccObjectManager(reinterpret_cast<hyper>(pManager)); - m_pIMAcc->SetDefaultAction(reinterpret_cast<hyper>(m_xAccActionRef.get())); - } + + m_pIMAcc->SetXAccessible(reinterpret_cast<hyper>(m_xAccRef.get())); + m_pIMAcc->Put_XAccObjectManager(reinterpret_cast<hyper>(pManager)); + m_pIMAcc->SetDefaultAction(reinterpret_cast<hyper>(m_xAccActionRef.get())); } /** * Destructor. commit ca546a00ffdd66d2a6f1f9d32474a6fc98d4e6e2 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Aug 21 08:52:03 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Aug 21 18:48:48 2024 +0200 wina11y: Add missing include in acccommon.h This makes sure that typedefs like `REFGUID` and `LONG` are known and can e.g. be processed by Qt Creator's code model. The missing include was not causing build problems because the source files including acccommon.h include stdafx.h first themselves. Change-Id: Ifd93cdc263471314f6ed777ba71b15f2bff35417 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172178 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/winaccessibility/source/UAccCOM/acccommon.h b/winaccessibility/source/UAccCOM/acccommon.h index d2dffc5e60b8..44003292be7f 100644 --- a/winaccessibility/source/UAccCOM/acccommon.h +++ b/winaccessibility/source/UAccCOM/acccommon.h @@ -19,6 +19,8 @@ #pragma once +#include "stdafx.h" + //for MAccessible.cxx struct ltComp { commit 114e827c883896167672597d9b4ad5569c80fe4b Author: Michael Weghorn <[email protected]> AuthorDate: Wed Aug 21 08:44:04 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Aug 21 18:48:41 2024 +0200 wina11y: Drop AccObject::ImplInitializeCreateObj As the method name and comment suggests, this method was doing more in the past, but that's no more the case. The only thing it does is doing an assert, but there's no need to have a separate method for this, so just do that right away in the (so far) only caller. Change-Id: Ief41c8d4ec350622eb043340a4b0bd1079d337a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172177 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx index 9e909f5b92d1..46fc12aa65e1 100644 --- a/winaccessibility/inc/AccObject.hxx +++ b/winaccessibility/inc/AccObject.hxx @@ -59,8 +59,6 @@ private: css::uno::Reference < css::accessibility::XAccessibleAction > m_xAccActionRef; css::uno::Reference < css::accessibility::XAccessibleContext > m_xAccContextRef; - void ImplInitializeCreateObj();//create COM object - void UpdateActionDesc(); void UpdateRole(); diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index b102c3b355b0..99b05f2e2df2 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -265,7 +265,7 @@ AccObject::AccObject(XAccessible* pAcc, AccObjectWinManager* pManager, m_pListener (pListener), m_xAccRef( pAcc ) { - ImplInitializeCreateObj(); + assert(m_pIMAcc); m_xAccContextRef = m_xAccRef->getAccessibleContext(); m_xAccActionRef.set(m_xAccContextRef,UNO_QUERY); @@ -346,16 +346,6 @@ void AccObject::UpdateValidWindow() m_pIMAcc->Put_XAccWindowHandle(m_pParantID); } -/** - * Translate all UNO basic information into MSAA com information. - * @param - * @return If the method is correctly processed. - */ -void AccObject::ImplInitializeCreateObj() -{ - assert(m_pIMAcc); -} - /** * Update default action property to com object. * @param
