diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-10 13:36:34 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-11-11 07:16:20 +0000 |
commit | db17d3c17c40d6b0e92392cf3c6e343d1d17b771 (patch) | |
tree | 9d562fcf764e7717df9585ef0e735a12ea4aaa16 /dbaccess | |
parent | 2ce9e4be4a438203382cb9cca824ce3e90647f3a (diff) |
new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to
use std::unique_ptr
Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc
Reviewed-on: https://gerrit.libreoffice.org/19884
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index a725df434609..c57fd075df9a 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -107,6 +107,7 @@ #include <connectivity/FValue.hxx> #include <editeng/justifyitem.hxx> +#include <memory> namespace dbaui { @@ -825,7 +826,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent, pPool->SetDefaultMetric( SFX_MAPUNIT_TWIP ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same - SfxItemSet* pFormatDescriptor = new SfxItemSet(*pPool, aAttrMap); + std::unique_ptr<SfxItemSet> pFormatDescriptor(new SfxItemSet(*pPool, aAttrMap)); // fill it pFormatDescriptor->Put(SvxHorJustifyItem(_eJustify, SBA_ATTR_ALIGN_HOR_JUSTIFY)); bool bText = false; @@ -852,7 +853,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent, } { // want the dialog to be destroyed before our set - ScopedVclPtrInstance< SbaSbAttrDlg > aDlg(_pParent, pFormatDescriptor, _pFormatter, _bHasFormat); + ScopedVclPtrInstance< SbaSbAttrDlg > aDlg(_pParent, pFormatDescriptor.get(), _pFormatter, _bHasFormat); if (RET_OK == aDlg->Execute()) { // ItemSet->UNO @@ -890,7 +891,6 @@ bool callColumnFormatDialog(vcl::Window* _pParent, } } - delete pFormatDescriptor; SfxItemPool::Free(pPool); for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) delete pDefaults[i]; |