diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-01 16:22:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-06 07:01:34 +0000 |
commit | 0323253a7c67316cb96e4a64792ab4fe74aac1ca (patch) | |
tree | 81787c4ae44ff778aa41e12574cd60a624c9277b /comphelper | |
parent | 4d666f5092d7c4f2ece9702dda4d874e44cdc6f7 (diff) |
remove some manual ref-counting
triggered when I noticed a class doing acquire() in the
constructor and then release() in the destructor.
found mostly by
git grep -n -B5 -e '->release()'
Change-Id: I96e43a3d30ffd9ae9a34275f24cd914d8f7b026f
Reviewed-on: https://gerrit.libreoffice.org/25806
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/accessiblewrapper.cxx | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx index e106b9dd14e1..41fb4f540fed 100644 --- a/comphelper/source/misc/accessiblewrapper.cxx +++ b/comphelper/source/misc/accessiblewrapper.cxx @@ -347,18 +347,15 @@ namespace comphelper ,m_xInnerContext( _rxInnerAccessibleContext ) ,m_xOwningAccessible( _rxOwningAccessible ) ,m_xParentAccessible( _rxParentAccessible ) - ,m_pChildMapper( nullptr ) - { // initialize the mapper for our children - m_pChildMapper = new OWrappedAccessibleChildrenManager( getComponentContext() ); - m_pChildMapper->acquire(); - + ,m_xChildMapper( new OWrappedAccessibleChildrenManager( getComponentContext() ) ) + { // determine if we're allowed to cache children Reference< XAccessibleStateSet > xStates( m_xInnerContext->getAccessibleStateSet( ) ); OSL_ENSURE( xStates.is(), "OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper: no inner state set!" ); - m_pChildMapper->setTransientChildren( !xStates.is() || xStates->contains( AccessibleStateType::MANAGES_DESCENDANTS) ); + m_xChildMapper->setTransientChildren( !xStates.is() || xStates->contains( AccessibleStateType::MANAGES_DESCENDANTS) ); - m_pChildMapper->setOwningAccessible( m_xOwningAccessible ); + m_xChildMapper->setOwningAccessible( m_xOwningAccessible ); } @@ -383,9 +380,6 @@ namespace comphelper OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper( ) { OSL_ENSURE( m_rBHelper.bDisposed, "OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper: you should ensure (in your dtor) that the object is disposed!" ); - - m_pChildMapper->release(); - m_pChildMapper = nullptr; } @@ -411,7 +405,7 @@ namespace comphelper { // get the child of the wrapped component Reference< XAccessible > xInnerChild = m_xInnerContext->getAccessibleChild( i ); - return m_pChildMapper->getAccessibleWrapperFor( xInnerChild ); + return m_xChildMapper->getAccessibleWrapperFor( xInnerChild ); } @@ -446,10 +440,10 @@ namespace comphelper // translate the event queryInterface( cppu::UnoType<XInterface>::get() ) >>= aTranslatedEvent.Source; - m_pChildMapper->translateAccessibleEvent( _rEvent, aTranslatedEvent ); + m_xChildMapper->translateAccessibleEvent( _rEvent, aTranslatedEvent ); // see if any of these notifications affect our child manager - m_pChildMapper->handleChildNotification( _rEvent ); + m_xChildMapper->handleChildNotification( _rEvent ); if ( aTranslatedEvent.NewValue == m_xInner ) aTranslatedEvent.NewValue = makeAny(aTranslatedEvent.Source); @@ -472,7 +466,7 @@ namespace comphelper xBroadcaster->removeAccessibleEventListener( this ); // dispose the child cache/map - m_pChildMapper->dispose(); + m_xChildMapper->dispose(); // let the base class dispose the inner component OComponentProxyAggregationHelper::dispose(); |