[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 10 17:33:50 UTC 2021


 sc/source/core/data/drwlayer.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 99420dc0b80df22d12519efca05803898fbfcfbd
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jul 23 17:48:00 2021 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Aug 10 19:33:11 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>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120223
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 5b70046e4448..1ead0b8fe872 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1598,7 +1598,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());
@@ -1668,7 +1668,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