diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-17 13:24:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-24 07:58:23 +0100 |
commit | cfb598178b2b38023c9237578904303bea7962e7 (patch) | |
tree | 42ba7bd9d613178ea21773ae7cf30cc94b02c7b3 /framework | |
parent | 570786e75add710df9bf77fa53b75e22dc29de89 (diff) |
loplugin:useuniqueptr in ImageListsDescriptor
Change-Id: I165af348b6d8863a4b1e5dd164d92c29f49d09c0
Reviewed-on: https://gerrit.libreoffice.org/48423
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/xml/imagesconfiguration.hxx | 8 | ||||
-rw-r--r-- | framework/source/uiconfiguration/imagemanagerimpl.cxx | 2 | ||||
-rw-r--r-- | framework/source/xml/imagesdocumenthandler.cxx | 8 |
3 files changed, 8 insertions, 10 deletions
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx index 68291bea7a26..1ead958915cc 100644 --- a/framework/inc/xml/imagesconfiguration.hxx +++ b/framework/inc/xml/imagesconfiguration.hxx @@ -76,12 +76,10 @@ typedef std::vector<std::unique_ptr<ImageListItemDescriptor> > ImageListDescript struct ImageListsDescriptor { - ImageListsDescriptor() : pImageList( nullptr ), - pExternalImageList( nullptr ) {} - ~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; } + ImageListsDescriptor() {} - ImageListDescriptor* pImageList; - ExternalImageItemListDescriptor* pExternalImageList; + std::unique_ptr<ImageListDescriptor> pImageList; + std::unique_ptr<ExternalImageItemListDescriptor> pExternalImageList; }; class ImagesConfiguration diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index f47666b5270f..ee88e2756541 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -400,7 +400,7 @@ bool ImageManagerImpl::implts_storeUserImages( if ( pImageList->GetImageCount() > 0 ) { ImageListsDescriptor aUserImageListInfo; - aUserImageListInfo.pImageList = new ImageListDescriptor; + aUserImageListInfo.pImageList.reset( new ImageListDescriptor ); ImageListItemDescriptor* pList = new ImageListItemDescriptor; aUserImageListInfo.pImageList->push_back( std::unique_ptr<ImageListItemDescriptor>(pList) ); diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index cc0278807052..327e666fde9d 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -197,7 +197,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( } if ( !m_aImageList.pImageList ) - m_aImageList.pImageList = new ImageListDescriptor; + m_aImageList.pImageList.reset( new ImageListDescriptor ); m_bImagesStartFound = true; m_pImages = new ImageListItemDescriptor; @@ -511,7 +511,7 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName) if ( m_pExternalImages && !m_aImageList.pExternalImageList ) { if ( !m_aImageList.pExternalImageList ) - m_aImageList.pExternalImageList = m_pExternalImages; + m_aImageList.pExternalImageList.reset( m_pExternalImages ); } m_bExternalImagesStartFound = false; @@ -614,7 +614,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument() if ( m_aImageListsItems.pImageList ) { - ImageListDescriptor* pImageList = m_aImageListsItems.pImageList; + ImageListDescriptor* pImageList = m_aImageListsItems.pImageList.get(); for ( size_t i = 0; i < m_aImageListsItems.pImageList->size(); i++ ) { @@ -625,7 +625,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument() if ( m_aImageListsItems.pExternalImageList ) { - WriteExternalImageList( m_aImageListsItems.pExternalImageList ); + WriteExternalImageList( m_aImageListsItems.pExternalImageList.get() ); } m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); |