diff options
author | Xisco Fauli <anistenis@gmail.com> | 2016-06-05 00:14:37 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-06 07:11:27 +0000 |
commit | 3e2ce043daeb4ba470a64909765336e9bc931fd4 (patch) | |
tree | 1d7722e3214668534c56ae4bac8555aa21b643c1 | |
parent | 353e5ea62ed6a273a3856bd1e3cb4d2380804e83 (diff) |
tdf#89329: use unique_ptr for pImpl in mailmodelapi
Change-Id: I12a6cb23b938f0d9151fb90437956ddb9d63d66f
Reviewed-on: https://gerrit.libreoffice.org/25907
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/sfx2/mailmodelapi.hxx | 7 | ||||
-rw-r--r-- | sfx2/source/dialog/mailmodel.cxx | 20 |
2 files changed, 11 insertions, 16 deletions
diff --git a/include/sfx2/mailmodelapi.hxx b/include/sfx2/mailmodelapi.hxx index ba8285e80bd5..7d048b7298bb 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 3622c9fb7014..1522234ef25f 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 { |