summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-27 12:52:16 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-10-27 12:48:50 +0000
commite25669fcedcb7231254d3ba0e0224b2e3eb901d8 (patch)
tree05ce242744c88d9efcd5b685720b2178008c2c8c /svtools
parent96d03636a5f932151c7842ae34631258891fe807 (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')
-rw-r--r--svtools/source/control/valueacc.cxx15
-rw-r--r--svtools/source/control/valueimp.hxx2
2 files changed, 8 insertions, 9 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;
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index d86336dff618..f1c1ac54311b 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -59,7 +59,7 @@ struct ValueSetItem
OUString maText;
void* mpData;
bool mbSelected;
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
+ css::uno::Reference< css::accessibility::XAccessible > mxAcc;
explicit ValueSetItem( ValueSet& rParent );
~ValueSetItem();