xmloff/source/text/XMLTextListAutoStylePool.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
New commits: commit e750c1f35bb2f6dcd9824a9a4d6adbaf72c44a34 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Sep 19 09:11:54 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Sep 19 11:58:42 2018 +0200 convert XMLTextListAutoStylePool_Impl to sorted_vector<unique_ptr<>> Change-Id: Ic40e4034b30ec527a3a3dbb0d74506478d2dd0a5 Reviewed-on: https://gerrit.libreoffice.org/60740 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index a2bd595bd969..3736a201ca74 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -118,8 +118,8 @@ XMLTextListAutoStylePoolEntry_Impl::XMLTextListAutoStylePoolEntry_Impl( struct XMLTextListAutoStylePoolEntryCmp_Impl { bool operator()( - XMLTextListAutoStylePoolEntry_Impl* const& r1, - XMLTextListAutoStylePoolEntry_Impl* const& r2 ) const + std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> const& r1, + std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> const& r2 ) const { if( r1->IsNamed() ) { @@ -137,7 +137,7 @@ struct XMLTextListAutoStylePoolEntryCmp_Impl } } }; -class XMLTextListAutoStylePool_Impl : public o3tl::sorted_vector<XMLTextListAutoStylePoolEntry_Impl*, XMLTextListAutoStylePoolEntryCmp_Impl> {}; +class XMLTextListAutoStylePool_Impl : public o3tl::sorted_vector<std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl>, XMLTextListAutoStylePoolEntryCmp_Impl> {}; XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : rExport( rExp ), @@ -157,8 +157,6 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : XMLTextListAutoStylePool::~XMLTextListAutoStylePool() { - // The XMLTextListAutoStylePoolEntry_Impl object in the pool need delete explicitly in dtor. - pPool->DeleteAndDestroyAll(); } void XMLTextListAutoStylePool::RegisterName( const OUString& rName ) @@ -206,12 +204,12 @@ OUString XMLTextListAutoStylePool::Add( } else { - XMLTextListAutoStylePoolEntry_Impl *pEntry = + std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl> pEntry( new XMLTextListAutoStylePoolEntry_Impl( pPool->size(), rNumRules, m_aNames, sPrefix, - nName ); - pPool->insert( pEntry ); + nName )); sName = pEntry->GetName(); + pPool->insert( std::move(pEntry) ); } return sName; @@ -253,7 +251,7 @@ void XMLTextListAutoStylePool::exportXML() const sal_uInt32 i; for( i=0; i < nCount; i++ ) { - XMLTextListAutoStylePoolEntry_Impl *pEntry = (*pPool)[i]; + XMLTextListAutoStylePoolEntry_Impl *pEntry = (*pPool)[i].get(); SAL_WARN_IF( pEntry->GetPos() >= nCount, "xmloff", "Illegal pos" ); aExpEntries[pEntry->GetPos()] = pEntry; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits