diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-15 10:02:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-16 10:27:15 +0100 |
commit | f8fcff9640f391a6bab7d9401d2656b3781c50cf (patch) | |
tree | 030f276ab2389b568140dcac6953a43174a98d29 /sc/source/ui/unoobj | |
parent | 99b20e589e64fbcf374d84ae68911ef2a96e537c (diff) |
pass ScAutoFormatData around with unique_ptr
Change-Id: Ia112f42560955029a4a337a080a3aa0659db06b8
Reviewed-on: https://gerrit.libreoffice.org/66419
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r-- | sc/source/ui/unoobj/afmtuno.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 81aee84f9a3d..56c711623df0 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -224,10 +224,10 @@ void SAL_CALL ScAutoFormatsObj::insertByName( const OUString& aName, const uno:: throw container::ElementExistException(); } - ScAutoFormatData* pNew = new ScAutoFormatData(); + std::unique_ptr<ScAutoFormatData> pNew(new ScAutoFormatData()); pNew->SetName( aName ); - if (pFormats->insert(pNew)) + if (pFormats->insert(std::move(pNew)) != pFormats->end()) { //! notify to other objects pFormats->Save(); @@ -493,13 +493,13 @@ void SAL_CALL ScAutoFormatObj::setName( const OUString& aNewName ) ScAutoFormatData *const pData = it->second.get(); OSL_ENSURE(pData,"AutoFormat data not available"); - ScAutoFormatData* pNew = new ScAutoFormatData(*pData); + std::unique_ptr<ScAutoFormatData> pNew(new ScAutoFormatData(*pData)); pNew->SetName( aNewName ); pFormats->erase(it); - if (pFormats->insert(pNew)) + it = pFormats->insert(std::move(pNew)); + if (it != pFormats->end()) { - it = pFormats->find(pNew); ScAutoFormat::iterator itBeg = pFormats->begin(); nFormatIndex = std::distance(itBeg, it); |