diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-27 12:52:16 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-27 12:48:50 +0000 |
commit | e25669fcedcb7231254d3ba0e0224b2e3eb901d8 (patch) | |
tree | 05ce242744c88d9efcd5b685720b2178008c2c8c /svtools/source/control/valueacc.cxx | |
parent | 96d03636a5f932151c7842ae34631258891fe807 (diff) |
don't allocate uno::Reference on the heap
There is no point, since it's the size of a pointer anyway
(found by temporarily making the new operator in uno::Reference
deleted).
Change-Id: I62a8b957fef9184f65d705600acfdab4116dcb34
Reviewed-on: https://gerrit.libreoffice.org/19603
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svtools/source/control/valueacc.cxx')
-rw-r--r-- | svtools/source/control/valueacc.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 0f8a0a13e2eb..f932092933ea 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -42,7 +42,7 @@ ValueSetItem::ValueSetItem( ValueSet& rParent ) , mbVisible(true) , mpData(NULL) , mbSelected(false) - , mpxAcc(NULL) + , mxAcc() { } @@ -50,10 +50,9 @@ ValueSetItem::ValueSetItem( ValueSet& rParent ) ValueSetItem::~ValueSetItem() { - if( mpxAcc ) + if( mxAcc.is() ) { - static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed(); - delete mpxAcc; + static_cast< ValueItemAcc* >( mxAcc.get() )->ParentDestroyed(); } } @@ -61,10 +60,10 @@ ValueSetItem::~ValueSetItem() uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled ) { - if( !mpxAcc ) - mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this, bIsTransientChildrenDisabled ) ); + if( !mxAcc.is() ) + mxAcc = new ValueItemAcc( this, bIsTransientChildrenDisabled ); - return *mpxAcc; + return mxAcc; } @@ -897,7 +896,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() } // Do not create an accessible object for the test. - if (pItem != NULL && pItem->mpxAcc != NULL) + if (pItem != NULL && pItem->mxAcc.is()) if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this ) { nIndexInParent = i; |