diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-02-16 10:54:00 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-16 20:32:02 +0000 |
commit | 8c1a3422dbce3236ca310e0541ca9d1ead2fc166 (patch) | |
tree | 2effc03799c40db51931574e9be4553de76ead52 | |
parent | 7bdc09ffa44e85544d38131702c4264f006c039d (diff) |
SfxRequest::GetMacroRecorder arg is always derefed before passed
so null can never be seen in the function
Change-Id: Iebe25ca26aa3f2105e4e20a0742c6cccbbf8b182
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147150
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/request.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/request.cxx | 16 |
2 files changed, 6 insertions, 12 deletions
diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx index 2d5939758eec..966974498065 100644 --- a/include/sfx2/request.hxx +++ b/include/sfx2/request.hxx @@ -98,7 +98,7 @@ public: void SetReturnValue(const SfxPoolItem &); const SfxPoolItem* GetReturnValue() const; - static css::uno::Reference< css::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame const * pFrame ); + static css::uno::Reference< css::frame::XDispatchRecorder > GetMacroRecorder(const SfxViewFrame& rFrame); static bool HasMacroRecorder(const SfxViewFrame& rFrame); SfxCallMode GetCallMode() const; void AllowRecording( bool ); diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index e7757adc82ef..4cfeb629121c 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -164,7 +164,7 @@ SfxRequest::SfxRequest if (pImpl->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl(nSlot, &pImpl->pShell, &pImpl->pSlot, true, true)) { pImpl->SetPool( &pImpl->pShell->GetPool() ); - pImpl->xRecorder = SfxRequest::GetMacroRecorder(pImpl->pViewFrame); + pImpl->xRecorder = SfxRequest::GetMacroRecorder(*pImpl->pViewFrame); if (pImpl->xRecorder) pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext()); pImpl->aTarget = pImpl->pShell->GetName(); @@ -205,7 +205,7 @@ SfxRequest::SfxRequest if( pImpl->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl( nSlotId, &pImpl->pShell, &pImpl->pSlot, true, true ) ) { pImpl->SetPool( &pImpl->pShell->GetPool() ); - pImpl->xRecorder = SfxRequest::GetMacroRecorder( pViewFrame ); + pImpl->xRecorder = SfxRequest::GetMacroRecorder(*pViewFrame); if (pImpl->xRecorder) pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext()); pImpl->aTarget = pImpl->pShell->GetName(); @@ -673,7 +673,7 @@ bool SfxRequest::IsDone() const } -css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorder( SfxViewFrame const * pView ) +css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorder(const SfxViewFrame& rView) /* [Description] @@ -687,14 +687,8 @@ css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorde { css::uno::Reference< css::frame::XDispatchRecorder > xRecorder; - if (!pView) - pView = SfxViewFrame::Current(); - - if (!pView) - return xRecorder; - css::uno::Reference< css::beans::XPropertySet > xSet( - pView->GetFrame().GetFrameInterface(), + rView.GetFrame().GetFrameInterface(), css::uno::UNO_QUERY); if(xSet.is()) @@ -711,7 +705,7 @@ css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorde bool SfxRequest::HasMacroRecorder(const SfxViewFrame& rView) { - return GetMacroRecorder(&rView).is(); + return GetMacroRecorder(rView).is(); } bool SfxRequest::IsAPI() const |