include/sfx2/mailmodelapi.hxx | 7 ++++--- sfx2/source/dialog/mailmodel.cxx | 20 +++++++------------- 2 files changed, 11 insertions(+), 16 deletions(-)
New commits: commit 3e2ce043daeb4ba470a64909765336e9bc931fd4 Author: Xisco Fauli <aniste...@gmail.com> Date: Sun Jun 5 00:14:37 2016 +0200 tdf#89329: use unique_ptr for pImpl in mailmodelapi Change-Id: I12a6cb23b938f0d9151fb90437956ddb9d63d66f Reviewed-on: https://gerrit.libreoffice.org/25907 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/include/sfx2/mailmodelapi.hxx b/include/sfx2/mailmodelapi.hxx index ba8285e..7d048b7 100644 --- a/include/sfx2/mailmodelapi.hxx +++ b/include/sfx2/mailmodelapi.hxx @@ -26,6 +26,7 @@ #include <sfx2/dllapi.h> #include <tools/link.hxx> #include <vector> +#include <memory> // class AddressList_Impl ------------------------------------------------ typedef ::std::vector< OUString > AddressList_Impl; @@ -71,9 +72,9 @@ protected: OUString& rFileNamePath ); private: - AddressList_Impl* mpToList; - AddressList_Impl* mpCcList; - AddressList_Impl* mpBccList; + std::unique_ptr<AddressList_Impl> mpToList; + std::unique_ptr<AddressList_Impl> mpCcList; + std::unique_ptr<AddressList_Impl> mpBccList; OUString maFromAddress; OUString maSubject; diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 3622c9f..1522234 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -648,18 +648,12 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( return eRet; } -SfxMailModel::SfxMailModel() : - mpToList ( nullptr ), - mpCcList ( nullptr ), - mpBccList ( nullptr ) +SfxMailModel::SfxMailModel() { } SfxMailModel::~SfxMailModel() { - delete mpToList; - delete mpCcList; - delete mpBccList; } void SfxMailModel::AddAddress( const OUString& rAddress, AddressRole eRole ) @@ -672,22 +666,22 @@ void SfxMailModel::AddAddress( const OUString& rAddress, AddressRole eRole ) { if ( !mpToList ) // create the list - mpToList = new AddressList_Impl(); - pList = mpToList; + mpToList.reset(new AddressList_Impl); + pList = mpToList.get(); } else if ( ROLE_CC == eRole ) { if ( !mpCcList ) // create the list - mpCcList = new AddressList_Impl(); - pList = mpCcList; + mpCcList.reset(new AddressList_Impl); + pList = mpCcList.get(); } else if ( ROLE_BCC == eRole ) { if ( !mpBccList ) // create the list - mpBccList = new AddressList_Impl(); - pList = mpBccList; + mpBccList.reset(new AddressList_Impl); + pList = mpBccList.get(); } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits