diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-05 12:23:41 +0000 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-05 20:12:21 +0100 |
commit | f40a68f58dd1fc8b4cbd89434559c3400e7bd39b (patch) | |
tree | 22455072db912e44de2e61612be20d77e589202f /winaccessibility/source | |
parent | c82a5669bc996bc23baebb3838fbabc629ef5d75 (diff) |
wina11y: Drop unnecessary exception handling
Window::GetSystemData should never throw an
exception, so there's no need for exception
handling here. Also, return early if the
system data is null.
Change-Id: I65794f10019d0c2fb5cc7150500b551c31cc2a08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177887
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'winaccessibility/source')
-rw-r--r-- | winaccessibility/source/service/AccTopWindowListener.cxx | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx index 40d9ba8755c1..181d7d8f4fa2 100644 --- a/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/winaccessibility/source/service/AccTopWindowListener.cxx @@ -47,45 +47,37 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* else if (auto pvclxcomponent = dynamic_cast<VCLXAccessibleComponent*>(pAccessible)) window = pvclxcomponent->GetWindow(); assert(window); - // The SalFrame of window may be destructed at this time - const SystemEnvData* systemdata = nullptr; - try - { - systemdata = window->GetSystemData(); - } - catch(...) - { - systemdata = nullptr; - } + + const SystemEnvData* pSystemData = window->GetSystemData(); + if (!pSystemData) + return; + Reference<css::accessibility::XAccessibleContext> xContext = pAccessible->getAccessibleContext(); if(!xContext.is()) return; // add all listeners - if (systemdata != nullptr) - { - m_aAccObjectManager.SaveTopWindowHandle(systemdata->hWnd, pAccessible); + m_aAccObjectManager.SaveTopWindowHandle(pSystemData->hWnd, pAccessible); - AddAllListeners(pAccessible,nullptr,systemdata->hWnd); + AddAllListeners(pAccessible, nullptr, pSystemData->hWnd); - if( window->GetStyle() & WB_MOVEABLE ) - m_aAccObjectManager.IncreaseState( pAccessible, static_cast<unsigned short>(-1) /* U_MOVEBLE */ ); + if( window->GetStyle() & WB_MOVEABLE ) + m_aAccObjectManager.IncreaseState( pAccessible, static_cast<unsigned short>(-1) /* U_MOVEBLE */ ); - short role = xContext->getAccessibleRole(); + short role = xContext->getAccessibleRole(); - if (role == css::accessibility::AccessibleRole::POPUP_MENU || - role == css::accessibility::AccessibleRole::MENU ) - { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::MENUPOPUPSTART); - } + if (role == css::accessibility::AccessibleRole::POPUP_MENU || + role == css::accessibility::AccessibleRole::MENU ) + { + m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::MENUPOPUPSTART); + } - if (role == css::accessibility::AccessibleRole::FRAME || - role == css::accessibility::AccessibleRole::DIALOG || - role == css::accessibility::AccessibleRole::WINDOW || - role == css::accessibility::AccessibleRole::ALERT) - { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::SHOW); - } + if (role == css::accessibility::AccessibleRole::FRAME || + role == css::accessibility::AccessibleRole::DIALOG || + role == css::accessibility::AccessibleRole::WINDOW || + role == css::accessibility::AccessibleRole::ALERT) + { + m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::SHOW); } } |