[Libreoffice-commits] core.git: sc/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 23 19:18:07 UTC 2021
sc/source/core/data/drwlayer.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 64a55fe5f457e4b3d5222deb560f6d5072696160
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jul 23 17:48:00 2021 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Jul 23 21:17:32 2021 +0200
tdf#143515: avoid memory leak in ScDrawLayer::DeleteObjectsInArea
... and in ScDrawLayer::DeleteObjectsInSelection.
We are calling SdrObjList::RemoveObject, which orphans the object.
Let the undo object own the SdrObject, and dispose it when needed.
Was that way ever since d0484bcdcbffd42d242647a2fdc1a203d176b775
"initial import".
Change-Id: I5f2cb9d8ed0e02d45d2699af4a228c7fd097008c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119435
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 7d31106ee7d7..1174cb656019 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1591,7 +1591,7 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
if (bRecording)
for (auto p : ppObj)
- AddCalcUndo(std::make_unique<SdrUndoRemoveObj>(*p));
+ AddCalcUndo(std::make_unique<SdrUndoDelObj>(*p));
for (auto p : ppObj)
pPage->RemoveObject(p->GetOrdNum());
@@ -1661,7 +1661,7 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
if (bRecording)
for (auto p : ppObj)
- AddCalcUndo(std::make_unique<SdrUndoRemoveObj>(*p));
+ AddCalcUndo(std::make_unique<SdrUndoDelObj>(*p));
for (auto p : ppObj)
pPage->RemoveObject(p->GetOrdNum());
More information about the Libreoffice-commits
mailing list