From 1fc105cec523a081f18ca78fff43e58e3a881232 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 20 Jul 2015 17:33:40 +0200 Subject: svtools: change these SvTreeListEntry functions to unique_ptr ... parameters to make it clear that they take ownership. Change-Id: I572c5fa6268438a86d0a4fa1d2aef15382cb5607 --- dbaccess/source/ui/control/dbtreelistbox.cxx | 4 ++-- dbaccess/source/ui/control/tabletree.cxx | 3 ++- dbaccess/source/ui/misc/WNameMatch.cxx | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index 191984d33a03..1944410d72f6 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -142,8 +142,8 @@ void DBTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& aStr, co { SvTreeListBox::InitEntry( _pEntry, aStr, _rCollEntryBmp,_rExpEntryBmp, eButtonKind); SvLBoxItem* pTextItem(_pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - SvLBoxString* pString = new OBoldListboxString( _pEntry, 0, aStr ); - _pEntry->ReplaceItem( pString,_pEntry->GetPos(pTextItem)); + std::unique_ptr pString(new OBoldListboxString(_pEntry, 0, aStr)); + _pEntry->ReplaceItem(std::move(pString), _pEntry->GetPos(pTextItem)); } void DBTreeListBox::implStopSelectionTimer() diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index 352b85c945ba..d2434126c177 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -409,7 +409,8 @@ void OTableTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& _rSt size_t nTextPos = _pEntry->GetPos(pTextItem); OSL_ENSURE(SvTreeListEntry::ITEM_NOT_FOUND != nTextPos, "OTableTreeListBox::InitEntry: no text item pos!"); - _pEntry->ReplaceItem(new OBoldListboxString(_pEntry, 0, _rString), nTextPos); + _pEntry->ReplaceItem(std::unique_ptr( + new OBoldListboxString(_pEntry, 0, _rString)), nTextPos); } SvTreeListEntry* OTableTreeListBox::implAddEntry( diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index aa1ba97bf273..f005583b8761 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -382,8 +382,8 @@ VCL_BUILDER_FACTORY(OColumnTreeBox) void OColumnTreeBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind) { DBTreeListBox::InitEntry(pEntry, rStr, rImg1, rImg2, eButtonKind); - SvLBoxString* pString = new OColumnString(pEntry, 0, rStr,false); - pEntry->ReplaceItem( pString, pEntry->ItemCount() - 1 ); + std::unique_ptr pString(new OColumnString(pEntry, 0, rStr,false)); + pEntry->ReplaceItem(std::move(pString), pEntry->ItemCount() - 1); } bool OColumnTreeBox::Select( SvTreeListEntry* pEntry, bool bSelect ) -- cgit