From 437db5267842d3985e3d4050096275da6dd45c3b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 31 Aug 2023 15:07:42 +0200 Subject: remove null checks for mpObj in UIObjectUnoObj Checking for mpObj == nullptr implies that in some sense this object could end up in that state, but the only way that can happen is if we call this object after its destructor has been called. In which case throwing RuntimeException is not appropriate because calling a dead object should not be possible. Rather just let it SIGSEGV instead of hiding it behind an exception that might be ignored. Change-Id: I92911a3108f74ed5dfa4986bec028cbc365ac916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156345 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/uitest/uno/uiobject_uno.cxx | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'vcl/source/uitest/uno') diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index a0a718096391..0d23fe9272a7 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -43,6 +43,7 @@ struct Notifier { UIObjectUnoObj::UIObjectUnoObj(std::unique_ptr pObj): mpObj(std::move(pObj)) { + assert(mpObj); } UIObjectUnoObj::~UIObjectUnoObj() @@ -53,9 +54,6 @@ UIObjectUnoObj::~UIObjectUnoObj() css::uno::Reference SAL_CALL UIObjectUnoObj::getChild(const OUString& rID) { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; std::unique_ptr pObj = mpObj->get_child(rID); return new UIObjectUnoObj(std::move(pObj)); @@ -116,9 +114,6 @@ IMPL_LINK_NOARG(ExecuteWrapper, ExecuteActionHdl, Timer*, void) void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::uno::Sequence& rPropValues) { - if (!mpObj) - throw css::uno::RuntimeException(); - auto aIdle = std::make_unique("UI Test Idle Handler"); aIdle->SetPriority(TaskPriority::HIGHEST); @@ -158,9 +153,6 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css:: css::uno::Sequence UIObjectUnoObj::getState() { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; StringMap aMap = mpObj->get_state(); css::uno::Sequence aProps(aMap.size()); @@ -173,9 +165,6 @@ css::uno::Sequence UIObjectUnoObj::getState() css::uno::Sequence UIObjectUnoObj::getChildren() { - if (!mpObj) - throw css::uno::RuntimeException(); - std::set aChildren; { @@ -191,9 +180,6 @@ css::uno::Sequence UIObjectUnoObj::getChildren() OUString SAL_CALL UIObjectUnoObj::getType() { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; return mpObj->get_type(); } @@ -215,9 +201,6 @@ css::uno::Sequence UIObjectUnoObj::getSupportedServiceNames() OUString SAL_CALL UIObjectUnoObj::getHierarchy() { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; return mpObj->dumpHierarchy(); } -- cgit