[Libreoffice-commits] core.git: svx/source
Stephan Bergmann
sbergman at redhat.com
Tue Jun 13 09:32:34 UTC 2017
svx/source/unodraw/unomtabl.cxx | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
New commits:
commit fd7759ee8ac2f12b55a3834742ef63b858eda15a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jun 13 11:31:47 2017 +0200
Use unique_ptr in ItemPoolVector
Change-Id: I0ca2209d2fcbd7a16b67eee546b3ccc5393f2d42
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index 0796fc768308..ebb05b90733b 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -17,11 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+#include <memory>
#include <set>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/drawing/PointSequence.hpp>
+#include <o3tl/make_unique.hxx>
#include <svl/style.hxx>
#include <comphelper/sequence.hxx>
@@ -48,7 +51,7 @@
using namespace ::com::sun::star;
using namespace ::cppu;
-typedef std::vector< SfxItemSet* > ItemPoolVector;
+typedef std::vector<std::unique_ptr<SfxItemSet>> ItemPoolVector;
class SvxUnoMarkerTable : public WeakImplHelper< container::XNameContainer, lang::XServiceInfo >,
public SfxListener
@@ -109,14 +112,6 @@ SvxUnoMarkerTable::~SvxUnoMarkerTable() throw()
void SvxUnoMarkerTable::dispose()
{
- ItemPoolVector::iterator aIter = maItemSetVector.begin();
- const ItemPoolVector::iterator aEnd = maItemSetVector.end();
-
- while( aIter != aEnd )
- {
- delete (*aIter++);
- }
-
maItemSetVector.clear();
}
@@ -147,8 +142,9 @@ uno::Sequence< OUString > SAL_CALL SvxUnoMarkerTable::getSupportedServiceNames(
void SAL_CALL SvxUnoMarkerTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement )
{
- SfxItemSet* pInSet = new SfxItemSet( *mpModelPool, XATTR_LINESTART, XATTR_LINEEND );
- maItemSetVector.push_back( pInSet );
+ maItemSetVector.push_back(
+ o3tl::make_unique<SfxItemSet>( *mpModelPool, XATTR_LINESTART, XATTR_LINEEND ));
+ auto pInSet = maItemSetVector.back().get();
XLineEndItem aEndMarker(XATTR_LINEEND);
aEndMarker.SetName( aName );
@@ -198,7 +194,6 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName )
const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( XATTR_LINEEND ) ));
if( pItem->GetName() == aName )
{
- delete (*aIter);
maItemSetVector.erase( aIter );
return;
}
More information about the Libreoffice-commits
mailing list