sw/source/uibase/shells/drawdlg.cxx | 9 ++++++--- sw/source/uibase/shells/drwbassh.cxx | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
New commits: commit 6fc0b5ce07eee825d6f8a2741dfe1fa7a9238bea Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Aug 16 15:32:07 2021 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Tue Aug 17 15:16:35 2021 +0200 tdf#143778 these async callbacks expect to have SdrModel::IsChanged of false when they are entered. They are adapted from the original non-async SwDrawShell::ExecDrawDlg where the start of SwDrawShell::ExecDrawDlg has... bool bChanged = pDoc->IsChanged(); pDoc->SetChanged(false); and the end has if (pDoc->IsChanged()) GetShell().SetModified(); else if (bChanged) pDoc->SetChanged(); and before async dialogs the start and end happened before and after the dialog appeared and disappeared. The intent seems to be unset the sdrmodel-changed and restore its original state if the dialogs caused nothing to happen and to explicitly set SetModified on the document if something did. Now the async dialogs callback happens after SwDrawShell::ExecDrawDlg has ended and so the callbacks start with SdrModel::IsChanged at its original value (restored by the end of ExecDrawDlg), not the "false" they were originally written to expect. For simplicity set the SdrModel IsChanged to false at the start of the callbacks and continue to restore to the passed in bChanged state if there was no changes by the callback. Change-Id: I671b35acab6d1b391fa7e6590c09f8be135449b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120548 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit c64f221fc2e22ffa60c4d78240893f7f04531b3e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120576 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index 114b7f33b055..c80f4960f657 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -115,6 +115,8 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) pDlg->StartExecuteAsync([bChanged, bHasMarked, pDoc, pDlg, pSh, pView, this]( sal_Int32 nResult){ + pDoc->SetChanged(false); + if (nResult == RET_OK) { pSh->StartAction(); @@ -168,6 +170,8 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) pDlg->StartExecuteAsync([bChanged, bHasMarked, pDoc, pDlg, pSh, pView, this]( sal_Int32 nResult){ + pDoc->SetChanged(false); + if (nResult == RET_OK) { pSh->StartAction(); @@ -210,9 +214,8 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) if (pDoc->IsChanged()) GetShell().SetModified(); - else - if (bChanged) - pDoc->SetChanged(); + else if (bChanged) + pDoc->SetChanged(); } namespace diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index f901f32cc15d..274a60c52028 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -235,6 +235,8 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) pDlg->StartExecuteAsync([bCaption, bChanged, pDlg, pFrameFormat, pSdrView, pSh, &rMarkList, this]( sal_Int32 nResult){ + pSdrView->GetModel()->SetChanged(false); + if (nResult == RET_OK) { SwFormatVertOrient aVOrientFinal(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));