[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Xisco Fauli
anistenis at gmail.com
Mon Jun 6 07:11:48 UTC 2016
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 <anistenis at 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 <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at 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
{
More information about the Libreoffice-commits
mailing list