toolkit/source/controls/table/tablecontrol_impl.cxx | 9 ++++++--- toolkit/source/controls/table/tablecontrol_impl.hxx | 3 +++ winaccessibility/source/UAccCOM/AccActionBase.cxx | 8 ++++---- winaccessibility/source/UAccCOM/AccActionBase.h | 3 --- 4 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit 18d45783a6c9f0d13fa0fae7b623be0805d8d825 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 22 16:01:49 2023 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Aug 22 22:27:22 2023 +0200 wina11y: Drop CAccActionBase::GetXInterface Just use the `pRXAct` member directly. In particular the fact that all of the `CAccActionBase` methods mixed both ways of accessing the member (first checking `pRXAct` directly, but then retrieving it via `CAccActionBase::GetXInterface` to call a method on it) didn't really increase readability of the code. Change-Id: Ic6f5ce9a9b229b949ac656668e3bbf01cb65af2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155956 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx index 70940aa31b1e..0fb2d7bbcee6 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.cxx +++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx @@ -62,7 +62,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccActionBase::nActions(/*[out,retval]*/long* if( pRXAct.is() && nActions != nullptr ) { - *nActions = GetXInterface()->getAccessibleActionCount(); + *nActions = pRXAct->getAccessibleActionCount(); return S_OK; } *nActions = 0; @@ -85,7 +85,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccActionBase::doAction(/* [in] */ long actio if( pRXAct.is() ) { - return GetXInterface()->doAccessibleAction( actionIndex )?S_OK:E_FAIL; + return pRXAct->doAccessibleAction(actionIndex) ? S_OK : E_FAIL; } return E_FAIL; @@ -110,7 +110,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccActionBase::get_description(long actionInd if(!pRXAct.is()) return E_FAIL; - OUString ouStr = GetXInterface()->getAccessibleActionDescription(actionIndex); + OUString ouStr = pRXAct->getAccessibleActionDescription(actionIndex); SysFreeString(*description); *description = SysAllocString(o3tl::toW(ouStr.getStr())); @@ -156,7 +156,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccActionBase::get_keyBinding( if( !pRXAct.is() ) return E_FAIL; - Reference< XAccessibleKeyBinding > binding = GetXInterface()->getAccessibleActionKeyBinding(actionIndex); + Reference< XAccessibleKeyBinding > binding = pRXAct->getAccessibleActionKeyBinding(actionIndex); if( !binding.is() ) return E_FAIL; diff --git a/winaccessibility/source/UAccCOM/AccActionBase.h b/winaccessibility/source/UAccCOM/AccActionBase.h index 26d3e7d054aa..9bf2c70b4bb2 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.h +++ b/winaccessibility/source/UAccCOM/AccActionBase.h @@ -66,9 +66,6 @@ public: protected: css::uno::Reference<css::accessibility::XAccessibleAction> pRXAct; - -private: - css::accessibility::XAccessibleAction* GetXInterface() { return pRXAct.get(); } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit cd00bc50a7425e2f58d54de80b714cb6b0362dce Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 22 14:57:04 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Aug 22 22:27:11 2023 +0200 tdf#156473 a11y: Keep a reference to table's a11y object Keep a Reference to the a11y object in `TableControl_Impl`, to prevent the object from getting deleted while it's still needed. Fixes a crash with this backtrace on Windows when closing the macro dialog from tdf#156473 with the NVDA screen reader active: 1 cppu::WeakComponentImplHelperBase::release implbase.cxx 70 0x7ff97c1f0f72 2 cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext,com::sun::star::accessibility::XAccessibleComponent,com::sun::star::accessibility::XAccessibleEventBroadcaster,com::sun::star::lang::XServiceInfo>::release compbase.hxx 86 0x7ff9200cc5a4 3 rtl::Reference<accessibility::AccessibleGridControl>::clear ref.hxx 198 0x7ff9200cc25b 4 accessibility::AccessibleGridControlAccess::DisposeAccessImpl AccessibleGridControl.cxx 335 0x7ff9200cc17a 5 svt::table::TableControl_Impl::disposeAccessible tablecontrol_impl.cxx 2397 0x7ff955829173 6 svt::table::TableControl::dispose tablecontrol.cxx 74 0x7ff9558190e4 7 VclReferenceBase::disposeOnce vclreferencebase.cxx 39 0x7ff9494f4fda 8 VclPtr<vcl::Window>::disposeAndClear vclptr.hxx 207 0x7ff9556b0fbe 9 VCLXWindow::dispose vclxwindow.cxx 927 0x7ff9556b0c9c 10 SVTXGridControl::dispose svtxgridcontrol.cxx 766 0x7ff9557e2577 11 UnoControl::dispose unocontrol.cxx 362 0x7ff95585bc3c 12 toolkit::UnoGridControl::dispose gridcontrol.cxx 292 0x7ff9557c9667 13 UnoControlContainer::dispose unocontrolcontainer.cxx 413 0x7ff955874606 14 ControlContainerBase::dispose controlmodelcontainerbase.cxx 1387 0x7ff95573f480 15 UnoDialogControl::dispose dialogcontrol.cxx 336 0x7ff95576aca1 16 UnoControl::disposing unocontrol.cxx 670 0x7ff95585ee37 17 UnoControlContainer::disposing unocontrolcontainer.cxx 432 0x7ff95587487c 18 ControlContainerBase::disposing controlmodelcontainerbase.cxx 1394 0x7ff95573f555 19 UnoDialogControl::disposing dialogcontrol.cxx 343 0x7ff95576ad45 20 comphelper::OInterfaceContainerHelper4<com::sun::star::container::XContainerListener>::disposeAndClear interfacecontainer4.hxx 397 0x7ff955748752 21 ListenerMultiplexerBase<com::sun::star::container::XContainerListener>::disposeAndClear listenermultiplexer.hxx 106 0x7ff95572da7b 22 ControlModelContainerBase::dispose controlmodelcontainerbase.cxx 223 0x7ff95572d855 23 OGeometryControlModel_Base::disposing geometrycontrolmodel.cxx 429 0x7ff9557930f9 24 cppu::WeakAggComponentImplHelperBase::dispose implbase.cxx 230 0x7ff97c1f1dca 25 SbiInstance::~SbiInstance runtime.cxx 360 0x7ff975dfdd1b 26 SbModule::Run sbxmod.cxx 1189 0x7ff975d532e7 27 SbModule::Notify sbxmod.cxx 776 0x7ff975d525d3 28 SfxBroadcaster::Broadcast SfxBroadcaster.cxx 41 0x7ff96c5366ab 29 SbMethod::Broadcast sbxmod.cxx 2121 0x7ff975d59c07 30 SbxValue::Get sbxvalue.cxx 290 0x7ff975e7a6be 31 SbMethod::Call sbxmod.cxx 2077 0x7ff975d5988d 32 basprov::BasicScriptImpl::invoke basscript.cxx 255 0x7ff8bb962d8f 33 SfxObjectShell::CallXScript objmisc.cxx 1439 0x7ff96dfe53a0 34 SfxObjectShell::CallXScript objmisc.cxx 1468 0x7ff96dfe60c2 35 SwDoc::ExecMacro docbasic.cxx 122 0x7ff8c8b30c33 36 SwWrtShell::ExecMacro wrtsh3.cxx 326 0x7ff8c9ee2a45 37 SwWrtShell::ClickToField wrtsh2.cxx 396 0x7ff8c9ede8ce 38 SwEditWin::MouseButtonUp edtwin.cxx 4969 0x7ff8c9abbeae 39 ImplHandleMouseEvent winproc.cxx 720 0x7ff949306165 40 ImplHandleSalMouseButtonUp winproc.cxx 2353 0x7ff94930b0e7 41 ImplWindowFrameProc winproc.cxx 2702 0x7ff949309b92 42 SalFrame::CallCallback salframe.hxx 310 0x7ff9240b2c89 43 ImplHandleMouseMsg salframe.cxx 3292 0x7ff9240d48c1 44 SalFrameWndProc salframe.cxx 5688 0x7ff9240bbf9c 45 SalFrameWndProcW salframe.cxx 6043 0x7ff9240bb6f4 46 CallWindowProcW USER32 0x7ff9c395e858 47 DispatchMessageW USER32 0x7ff9c395e299 48 ImplSalDispatchMessage salinst.cxx 474 0x7ff924008e03 49 ImplSalYield salinst.cxx 546 0x7ff924008cad 50 WinSalInstance::DoYield salinst.cxx 580 0x7ff9240090f5 51 ImplYield svapp.cxx 352 0x7ff9499a3f3b 52 Application::Yield svapp.cxx 437 0x7ff9499a3923 53 Application::Execute svapp.cxx 329 0x7ff9499a372b 54 desktop::Desktop::Main app.cxx 1601 0x7ff97ef6caf3 55 ImplSVMain svmain.cxx 204 0x7ff9499be0a0 56 SVMain svmain.cxx 236 0x7ff9499bfce9 57 soffice_main sofficemain.cxx 94 0x7ff97efdb1d8 58 sal_main main.c 51 0x7ff7e580104a 59 main main.c 49 0x7ff7e5801029 60 invoke_main exe_common.inl 79 0x7ff7e5801269 61 __scrt_common_main_seh exe_common.inl 288 0x7ff7e580139e 62 __scrt_common_main exe_common.inl 331 0x7ff7e580141e 63 mainCRTStartup exe_main.cpp 17 0x7ff7e580143e 64 BaseThreadInitThunk KERNEL32 0x7ff9c2eb7614 65 RtlUserThreadStart ntdll 0x7ff9c4bc26b1 Change-Id: I10e44024f88465950953229e695e0cfe4c4a69c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155953 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/toolkit/source/controls/table/tablecontrol_impl.cxx b/toolkit/source/controls/table/tablecontrol_impl.cxx index c7306a079147..1b9b82b2bcb3 100644 --- a/toolkit/source/controls/table/tablecontrol_impl.cxx +++ b/toolkit/source/controls/table/tablecontrol_impl.cxx @@ -2371,6 +2371,9 @@ namespace svt::table Reference< XAccessible > TableControl_Impl::getAccessible( vcl::Window& i_parentWindow ) { + if (m_xAccessible.is()) + return m_xAccessible; + DBG_TESTSOLARMUTEX(); if ( m_pAccessibleTable == nullptr ) { @@ -2383,10 +2386,9 @@ namespace svt::table } } - Reference< XAccessible > xAccessible; if ( m_pAccessibleTable ) - xAccessible = m_pAccessibleTable->getMyself(); - return xAccessible; + m_xAccessible = m_pAccessibleTable->getMyself(); + return m_xAccessible; } @@ -2395,6 +2397,7 @@ namespace svt::table if ( m_pAccessibleTable ) m_pAccessibleTable->DisposeAccessImpl(); m_pAccessibleTable = nullptr; + m_xAccessible.clear(); } diff --git a/toolkit/source/controls/table/tablecontrol_impl.hxx b/toolkit/source/controls/table/tablecontrol_impl.hxx index 9e4d0649729f..2a16d6231ef2 100644 --- a/toolkit/source/controls/table/tablecontrol_impl.hxx +++ b/toolkit/source/controls/table/tablecontrol_impl.hxx @@ -19,6 +19,7 @@ #pragma once +#include <com/sun/star/accessibility/XAccessible.hpp> #include <controls/table/tablemodel.hxx> #include <controls/table/tablecontrolinterface.hxx> @@ -133,6 +134,8 @@ namespace svt::table vcl::AccessibleFactoryAccess m_aFactoryAccess; vcl::table::IAccessibleTableControl* m_pAccessibleTable; + css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; + public: void setModel( const PTableModel& _pModel );