summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx5
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx1
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx7
-rw-r--r--sw/source/uibase/dialog/regionsw.cxx16
-rw-r--r--vcl/jsdialog/enabled.cxx1
5 files changed, 21 insertions, 9 deletions
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 66ac1ec21a25..30e41e4edaf4 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -307,6 +307,11 @@ short AbstractEditRegionDlg_Impl::Execute()
return m_xDlg->run();
}
+bool AbstractEditRegionDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+ return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
short AbstractInsertSectionTabDialog_Impl::Execute()
{
return m_xDlg->run();
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index d5c1c43806d8..c2c043bb3eb6 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -663,6 +663,7 @@ public:
{
}
virtual short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
virtual void SelectSection(const OUString& rSectionName) override;
};
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index e3b56283f5cc..f1499b6a28ca 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -820,12 +820,15 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
aOrigArray.clear();
+ SwWrtShell& rSh = m_rSh;
+
// response must be called ahead of EndAction's end,
// otherwise ScrollError can occur.
m_xDialog->response(RET_OK);
- m_rSh.EndUndo();
- m_rSh.EndAllAction();
+ // accessing 'this' after response isn't safe, as the callback might cause the dialog to be disposed
+ rSh.EndUndo();
+ rSh.EndAllAction();
}
// Toggle protect
diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx
index 9eaa64c89456..71f0c165b458 100644
--- a/sw/source/uibase/dialog/regionsw.cxx
+++ b/sw/source/uibase/dialog/regionsw.cxx
@@ -217,15 +217,17 @@ void SwBaseShell::EditRegionDialog(SfxRequest const & rReq)
case FN_EDIT_CURRENT_REGION:
{
weld::Window* pParentWin = GetView().GetFrameWeld();
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ VclPtr<AbstractEditRegionDlg> pEditRegionDlg(pFact->CreateEditRegionDlg(pParentWin, rWrtShell));
+
+ if(auto pStringItem = dynamic_cast< const SfxStringItem *>( pItem ))
{
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractEditRegionDlg> pEditRegionDlg(pFact->CreateEditRegionDlg(pParentWin, rWrtShell));
- if(auto pStringItem = dynamic_cast< const SfxStringItem *>( pItem ))
- {
- pEditRegionDlg->SelectSection(pStringItem->GetValue());
- }
- pEditRegionDlg->Execute();
+ pEditRegionDlg->SelectSection(pStringItem->GetValue());
}
+ pEditRegionDlg->StartExecuteAsync([pEditRegionDlg](sal_Int32 /*nResult */){
+ pEditRegionDlg->disposeOnce();
+ });
}
break;
}
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 058880a97835..c8ed0d73efad 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -178,6 +178,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile)
|| rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui"
|| rUIFile == u"modules/swriter/ui/dropcapspage.ui"
|| rUIFile == u"modules/swriter/ui/dropdownfielddialog.ui"
+ || rUIFile == u"modules/swriter/ui/editsectiondialog.ui"
|| rUIFile == u"modules/swriter/ui/endnotepage.ui"
|| rUIFile == u"modules/swriter/ui/footendnotedialog.ui"
|| rUIFile == u"modules/swriter/ui/footnoteareapage.ui"