svx/source/svdraw/svdedxv.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit 717fed5b9be560640e20ecedbe9b241ed45b8fa7 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Sep 22 15:56:06 2021 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Sep 23 11:34:40 2021 +0200 svx: improve SdrObjEditView::DisposeUndoManager() Addresses the comment at <https://gerrit.libreoffice.org/c/core/+/122151/1/svx/source/svdraw/svdedxv.cxx#2765>, i.e. there can be the case when the undo manager is not an sw::UndoManager (or any other high level undo manager), but it's an EditUndoManager, and in that case we should not clear away the owning pointer to avoid a memory leak. (cherry picked from commit 4cf51357b75c254e7962dd86140c69474fff129f) Change-Id: I016cfad0563814d65c8523999c82be7747377171 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122509 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index af7a1353689d..d3507a3fd66d 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2762,7 +2762,11 @@ void SdrObjEditView::DisposeUndoManager() { if (pTextEditOutliner) { - pTextEditOutliner->SetUndoManager(nullptr); + if (typeid(pTextEditOutliner->GetUndoManager()) != typeid(EditUndoManager)) + { + // Non-owning pointer, clear it. + pTextEditOutliner->SetUndoManager(nullptr); + } } mpOldTextEditUndoManager = nullptr;