sw/source/ui/fldui/fldtdlg.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
New commits: commit da5580369bfd15857fb21a1f610e393d07abb805 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Mon Oct 4 17:40:31 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Oct 6 12:08:08 2021 +0200 tdf#144907: sw ui: allow closing of "Fields" dialog In some cases (described in task) dialog is not closed. This is happens due to not delivered request to SwTextShell::ExecField(). So we could just close dialog explicitly, if Execute() action did fail. Change-Id: I1c712295a21037bc8bb28e2a97e750299b41250c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123059 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index 946de356075e..f9a0f2241448 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -109,9 +109,16 @@ void SwFieldDlg::Close() { if (m_bClosing) return; - m_pBindings->GetDispatcher()-> + const SfxPoolItem* pResult = m_pBindings->GetDispatcher()-> Execute(m_bDataBaseMode ? FN_INSERT_FIELD_DATA_ONLY : FN_INSERT_FIELD, SfxCallMode::SYNCHRON|SfxCallMode::RECORD); + if (!pResult) + { + // If Execute action did fail for whatever reason, this means that request + // to close did fail or wasn't delivered to SwTextShell::ExecField(). + // Just explicitly close dialog in this case. + SfxTabDialogController::EndDialog(); + } } void SwFieldDlg::Initialize(SfxChildWinInfo const *pInfo)