sd/source/core/drawdoc4.cxx | 10 ++++++++-- sd/source/ui/func/undoheaderfooter.cxx | 6 ++++-- sd/source/ui/view/Outliner.cxx | 10 ++++++---- sd/source/ui/view/ViewShellImplementation.cxx | 14 +++++++++----- 4 files changed, 27 insertions(+), 13 deletions(-)
New commits: commit a4f5719d3cbe97664738872f9a3ce9c238a06f2a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Dec 15 20:25:18 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Dec 16 19:46:52 2022 +0000 sd: check SfxViewFrame::Current() these ones look potentially worth backporting Change-Id: I6153b0f9ead7caef9f228a5724f51823bcf87c07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144281 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 39e1dbdd2e012eff64855de56c0b3a49245d12c4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144294 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 3c75dd4315e1..59045056853e 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -1068,9 +1068,15 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, Sdr StartOnlineSpelling(); } else if (nCommand == SpellCallbackCommand::STARTSPELLDLG) - SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG, SfxCallMode::ASYNCHRON ); + { + if (SfxViewFrame* pViewFrame = SfxViewFrame::Current()) + pViewFrame->GetDispatcher()->Execute( SID_SPELL_DIALOG, SfxCallMode::ASYNCHRON ); + } else if (nCommand == SpellCallbackCommand::AUTOCORRECT_OPTIONS) - SfxViewFrame::Current()->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON ); + { + if (SfxViewFrame* pViewFrame = SfxViewFrame::Current()) + pViewFrame->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON ); + } } // Return formatted page number (1, I, i, a, etc.) diff --git a/sd/source/ui/func/undoheaderfooter.cxx b/sd/source/ui/func/undoheaderfooter.cxx index 648a2dd35842..e0183dac3142 100644 --- a/sd/source/ui/func/undoheaderfooter.cxx +++ b/sd/source/ui/func/undoheaderfooter.cxx @@ -39,13 +39,15 @@ SdHeaderFooterUndoAction::~SdHeaderFooterUndoAction() void SdHeaderFooterUndoAction::Undo() { mpPage->setHeaderFooterSettings( maOldSettings ); - SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); + if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) + pViewFrm->GetDispatcher()->Execute( SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } void SdHeaderFooterUndoAction::Redo() { mpPage->setHeaderFooterSettings( maNewSettings ); - SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); + if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) + pViewFrm->GetDispatcher()->Execute( SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 342b01b050dc..a633376926a6 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1925,13 +1925,15 @@ weld::Window* SdOutliner::GetMessageBoxParent() switch (meMode) { case SEARCH: - pChildWindow = SfxViewFrame::Current()->GetChildWindow( - SvxSearchDialogWrapper::GetChildWindowId()); + if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) + pChildWindow = pViewFrm->GetChildWindow( + SvxSearchDialogWrapper::GetChildWindowId()); break; case SPELL: - pChildWindow = SfxViewFrame::Current()->GetChildWindow( - sd::SpellDialogChildWindow::GetChildWindowId()); + if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) + pChildWindow = pViewFrm->GetChildWindow( + sd::SpellDialogChildWindow::GetChildWindowId()); break; case TEXT_CONVERSION: diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 5725feb2cc4f..a0c025ce5acf 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -304,12 +304,16 @@ SfxInterfaceId ViewShell::Implementation::GetViewId() const SvxIMapDlg* ViewShell::Implementation::GetImageMapDialog() { - SvxIMapDlg* pDialog = nullptr; - SfxChildWindow* pChildWindow = SfxViewFrame::Current()->GetChildWindow( + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if (!pViewFrm) + return nullptr; + + SfxChildWindow* pChildWindow = pViewFrm->GetChildWindow( SvxIMapDlgChildWindow::GetChildWindowId()); - if (pChildWindow != nullptr) - pDialog = dynamic_cast<SvxIMapDlg*>(pChildWindow->GetController().get()); - return pDialog; + if (pChildWindow == nullptr) + return nullptr; + + return dynamic_cast<SvxIMapDlg*>(pChildWindow->GetController().get()); } //===== ToolBarManagerLock ====================================================