diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-31 15:07:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-31 18:40:33 +0200 |
commit | 437db5267842d3985e3d4050096275da6dd45c3b (patch) | |
tree | 4d06df61126cadb040c6e967486c8802c305fa98 /vcl/source/uitest/uno | |
parent | fffdfd9e58a6ec31be775123ae6d3f90a6e8e840 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/uitest/uno')
-rw-r--r-- | vcl/source/uitest/uno/uiobject_uno.cxx | 19 |
1 files changed, 1 insertions, 18 deletions
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<UIObject> pObj): mpObj(std::move(pObj)) { + assert(mpObj); } UIObjectUnoObj::~UIObjectUnoObj() @@ -53,9 +54,6 @@ UIObjectUnoObj::~UIObjectUnoObj() css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UIObjectUnoObj::getChild(const OUString& rID) { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; std::unique_ptr<UIObject> 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<css::beans::PropertyValue>& rPropValues) { - if (!mpObj) - throw css::uno::RuntimeException(); - auto aIdle = std::make_unique<Idle>("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<css::beans::PropertyValue> UIObjectUnoObj::getState() { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; StringMap aMap = mpObj->get_state(); css::uno::Sequence<css::beans::PropertyValue> aProps(aMap.size()); @@ -173,9 +165,6 @@ css::uno::Sequence<css::beans::PropertyValue> UIObjectUnoObj::getState() css::uno::Sequence<OUString> UIObjectUnoObj::getChildren() { - if (!mpObj) - throw css::uno::RuntimeException(); - std::set<OUString> aChildren; { @@ -191,9 +180,6 @@ css::uno::Sequence<OUString> 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<OUString> UIObjectUnoObj::getSupportedServiceNames() OUString SAL_CALL UIObjectUnoObj::getHierarchy() { - if (!mpObj) - throw css::uno::RuntimeException(); - SolarMutexGuard aGuard; return mpObj->dumpHierarchy(); } |