sd/source/ui/func/sdundogr.cxx | 12 ++---------- sd/source/ui/inc/sdundogr.hxx | 7 ++++--- 2 files changed, 6 insertions(+), 13 deletions(-)
New commits: commit d9e8fdbcd2f834a483890b409ede1b44c2da5da3 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Tue Jul 11 23:00:06 2017 +0900 sd: Use std::unique_ptr<> as SdUndoGroup owns SdUndoActions Change-Id: Iaba3f3cf91e30b549e1b8ce3e54c0ef50df9f1d4 Reviewed-on: https://gerrit.libreoffice.org/39823 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Takeshi Abe <t...@fixedpoint.jp> diff --git a/sd/source/ui/func/sdundogr.cxx b/sd/source/ui/func/sdundogr.cxx index 963e7ddc1150..feb9c7b19d3a 100644 --- a/sd/source/ui/func/sdundogr.cxx +++ b/sd/source/ui/func/sdundogr.cxx @@ -20,15 +20,7 @@ #include "sdundogr.hxx" -SdUndoGroup::~SdUndoGroup() -{ - size_t nLast = aCtn.size(); - for (size_t nAction = 0; nAction < nLast; nAction++) - { - delete aCtn[nAction]; - } - aCtn.clear(); -} +SdUndoGroup::~SdUndoGroup() = default; bool SdUndoGroup::Merge( SfxUndoAction* pNextAction ) { @@ -73,7 +65,7 @@ void SdUndoGroup::Redo() void SdUndoGroup::AddAction(SdUndoAction* pAction) { - aCtn.push_back(pAction); + aCtn.emplace_back(pAction); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/sdundogr.hxx b/sd/source/ui/inc/sdundogr.hxx index c629edf699b8..160b947526cf 100644 --- a/sd/source/ui/inc/sdundogr.hxx +++ b/sd/source/ui/inc/sdundogr.hxx @@ -24,15 +24,16 @@ #include "sdundo.hxx" #include "sddllapi.h" +#include <memory> #include <vector> class SD_DLLPUBLIC SdUndoGroup : public SdUndoAction { - std::vector<SdUndoAction*> aCtn; + std::vector<std::unique_ptr<SdUndoAction>> aCtn; public: SdUndoGroup(SdDrawDocument* pSdDrawDocument) - : SdUndoAction(pSdDrawDocument), - aCtn() {} + : SdUndoAction(pSdDrawDocument) + {} virtual ~SdUndoGroup() override; virtual bool Merge( SfxUndoAction* pNextAction ) override; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits