sw/source/ui/fldui/fldtdlg.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit fc9383e943bdb07e1770af4eef8ffe8859c379f8
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Mon Oct 4 17:40:31 2021 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Thu Oct 7 08:34:10 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>
    (cherry picked from commit da5580369bfd15857fb21a1f610e393d07abb805)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122951
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 70d69203af14..d78bc66b811a 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -108,9 +108,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)

Reply via email to