diff options
-rw-r--r-- | include/svx/svdundo.hxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdundo.cxx | 19 |
2 files changed, 10 insertions, 15 deletions
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index 5fd24db225d5..793782d37ed1 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -207,10 +207,10 @@ public: class SVX_DLLPUBLIC SdrUndoGeoObj : public SdrUndoObj { protected: - SdrObjGeoData* pUndoGeo; - SdrObjGeoData* pRedoGeo; + std::unique_ptr<SdrObjGeoData> pUndoGeo; + std::unique_ptr<SdrObjGeoData> pRedoGeo; // If we have a group object: - SdrUndoGroup* pUndoGroup; + std::unique_ptr<SdrUndoGroup> pUndoGroup; /// If we have a table object, should its layout change? bool mbSkipChangeLayout; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index ecc2c78d90dd..ba2bff175356 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -581,9 +581,6 @@ OUString SdrUndoMoveObj::GetSdrRepeatComment(SdrView& /*rView*/) const SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj) : SdrUndoObj(rNewObj) - , pUndoGeo(nullptr) - , pRedoGeo(nullptr) - , pUndoGroup(nullptr) , mbSkipChangeLayout(false) { SdrObjList* pOL=rNewObj.GetSubList(); @@ -592,7 +589,7 @@ SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj) // this is a group object! // If this were 3D scene, we'd only add an Undo for the scene itself // (which we do elsewhere). - pUndoGroup=new SdrUndoGroup(*pObj->GetModel()); + pUndoGroup.reset(new SdrUndoGroup(*pObj->GetModel())); const size_t nObjCount = pOL->GetObjCount(); for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) { pUndoGroup->AddAction(new SdrUndoGeoObj(*pOL->GetObj(nObjNum))); @@ -600,15 +597,15 @@ SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj) } else { - pUndoGeo=pObj->GetGeoData(); + pUndoGeo.reset(pObj->GetGeoData()); } } SdrUndoGeoObj::~SdrUndoGeoObj() { - delete pUndoGeo; - delete pRedoGeo; - delete pUndoGroup; + pUndoGeo.reset(); + pRedoGeo.reset(); + pUndoGroup.reset(); } void SdrUndoGeoObj::Undo() @@ -625,8 +622,7 @@ void SdrUndoGeoObj::Undo() } else { - delete pRedoGeo; - pRedoGeo=pObj->GetGeoData(); + pRedoGeo.reset(pObj->GetGeoData()); auto pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pObj); if (pTableObj && mbSkipChangeLayout) @@ -648,8 +644,7 @@ void SdrUndoGeoObj::Redo() } else { - delete pUndoGeo; - pUndoGeo=pObj->GetGeoData(); + pUndoGeo.reset(pObj->GetGeoData()); pObj->SetGeoData(*pRedoGeo); } |