sd/source/ui/view/drviews4.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
New commits: commit 9968367d841a0a1bd81e1535cfc01b782d2febb5 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Mar 22 16:11:03 2021 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Apr 8 15:44:38 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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113784 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index c3557b4980d8..ec3ec5d11d31 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -58,6 +58,7 @@ #include <drawview.hxx> #include <svx/bmpmask.hxx> #include <LayerTabBar.hxx> +#include <ViewShellBase.hxx> #include <SlideSorterViewShell.hxx> #include <svx/svditer.hxx> @@ -65,6 +66,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 @@ -97,6 +118,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