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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 22 08:40:51 UTC 2021


 include/svx/svdedtv.hxx        |    2 +-
 svx/source/svdraw/svdedtv2.cxx |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 29df92dc04897796aa47815989c51f59975607fb
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 21 15:46:14 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 22 10:40:08 2021 +0200

    tdf#143412 CRASH: converting images
    
    Revert "use unique_ptr in SdrEditView::ImpConvertOneObj"
    This reverts commit 2ec1dab4693cd45b475f02452114dd96ec0bda1b.
    
    I was wrong, we are no returning ownership here.
    
    Change-Id: Ib3b3b32248d4b56f0a48c658db5d6431b26fc352
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119335
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 58c6fad213024ef8f162984a66af565ac9ad4b97)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119260

diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index eb815b728cb3..5d834d05bde7 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -125,7 +125,7 @@ protected:
     // converts an object, when positive it removes the old one from its List
     // and inserts the new one instead. including Undo.
     // Nor MarkEntry nor ModelChgBroadcast is created.
-    SdrObjectUniquePtr ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLineToArea);
+    SdrObject* ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLineToArea);
 
     // set both flags: bToTopPossible and bToBtmPossible.
     // bToTopPossibleDirty and bToBtmPossibleDirty are reset at the same time
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 27df56d91d76..1b27ce7031be 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -1975,7 +1975,7 @@ void SdrEditView::UnGroupMarked()
 // ConvertToPoly
 
 
-SdrObjectUniquePtr SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLineToArea)
+SdrObject* SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLineToArea)
 {
     SdrObjectUniquePtr pNewObj = pObj->ConvertToPolyObj(bPath, bLineToArea);
     if (pNewObj)
@@ -1985,12 +1985,13 @@ SdrObjectUniquePtr SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bo
         if( bUndo )
             AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pObj,*pNewObj));
 
+        // ownership passed into here (despite the UniquePtr indicating that we are returning it)
         pOL->ReplaceObject(pNewObj.get(), pObj->GetOrdNum());
 
         if( !bUndo )
             SdrObject::Free(pObj);
     }
-    return pNewObj;
+    return pNewObj.release();
 }
 
 void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea)
@@ -2034,10 +2035,10 @@ void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea)
                 ImpConvertOneObj(pObj,bPath,bLineToArea);
             }
         } else {
-            SdrObjectUniquePtr pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
+            SdrObject* pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
             if (pNewObj!=nullptr) {
                 bMrkChg=true;
-                GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj.release(),pPV),nm);
+                GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj,pPV),nm);
             }
         }
     }


More information about the Libreoffice-commits mailing list