sd/source/ui/view/drviews4.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
New commits: commit 4d1348edad5f884dd4d15d3c10cf935ba0100be1 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Mar 22 16:11:03 2021 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Mon Mar 29 13:55:47 2021 +0200 impress: avoid crash when user edits text and other deletes slide We need to end text edit when page is deleted by other user. Change-Id: I89824c91f5652421a443feb9412acbae65db8800 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112917 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index d6952d79685f..6b4c28d01e94 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -57,6 +57,7 @@ #include <drawview.hxx> #include <svx/bmpmask.hxx> #include <LayerTabBar.hxx> +#include <ViewShellBase.hxx> #include <SlideSorterViewShell.hxx> #include <svx/svditer.hxx> @@ -64,6 +65,26 @@ #include <navigatr.hxx> #include <memory> +namespace { + void EndTextEditOnPage(sal_uInt16 nPageId) + { + SfxViewShell* pShell = SfxViewShell::GetFirst(); + while (pShell) + { + ::sd::ViewShellBase* pBase = dynamic_cast<::sd::ViewShellBase*>(pShell); + if (pBase) + { + ::sd::ViewShell* pViewSh = pBase->GetMainViewShell().get(); + ::sd::DrawViewShell* pDrawSh = dynamic_cast<::sd::DrawViewShell*>(pViewSh); + if (pDrawSh && pDrawSh->GetDrawView() && pDrawSh->getCurrentPage()->getPageId() == nPageId) + pDrawSh->GetDrawView()->SdrEndTextEdit(); + } + + pShell = SfxViewShell::GetNext(*pShell); + } + } +} + namespace sd { #define PIPETTE_RANGE 0 @@ -96,6 +117,7 @@ void DrawViewShell::DeleteActualPage() if((bUseSlideSorter && IsSelected(nPageIndex)) || (!bUseSlideSorter && pPage->IsSelected())) { + EndTextEditOnPage(pPage->getPageId()); Reference< XDrawPage > xPage( xPages->getByIndex( nPageIndex ), UNO_QUERY_THROW ); pagesToDelete.push_back(xPage); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits