Get rid of trivial comphelper::in-/decrement wrappers

Change-Id: Id3a12ef9d56c30719f483e610c8a8b08caf05def
This commit is contained in:
Stephan Bergmann
2015-04-21 08:39:10 +02:00
parent 3d54555a1e
commit 4592d27dca
24 changed files with 68 additions and 83 deletions

View File

@@ -357,7 +357,7 @@ OButtonControl::OButtonControl(const Reference<XComponentContext>& _rxFactory)
,m_nTargetUrlFeatureId( -1 )
,m_bEnabledByPropertyValue( false )
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
// Register as ActionListener
Reference<XButton> xButton;
@@ -366,7 +366,7 @@ OButtonControl::OButtonControl(const Reference<XComponentContext>& _rxFactory)
xButton->addActionListener(this);
}
// For Listener: refcount at one
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}

View File

@@ -206,7 +206,7 @@ OGridColumn::OGridColumn( const Reference<XComponentContext>& _rContext, const O
// Create the UnoControlModel
if ( !m_aModelName.isEmpty() ) // is there a to-be-aggregated model?
{
increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
m_xAggregate.set( _rContext->getServiceManager()->createInstanceWithContext( m_aModelName, _rContext ), UNO_QUERY );
@@ -219,7 +219,7 @@ OGridColumn::OGridColumn( const Reference<XComponentContext>& _rContext, const O
}
// Set refcount back to zero
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}
}
@@ -235,7 +235,7 @@ OGridColumn::OGridColumn( const OGridColumn* _pOriginal )
m_aModelName = _pOriginal->m_aModelName;
m_aLabel = _pOriginal->m_aLabel;
increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
{
m_xAggregate = createAggregateClone( _pOriginal );
@@ -247,7 +247,7 @@ OGridColumn::OGridColumn( const OGridColumn* _pOriginal )
m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) );
}
}
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}

View File

@@ -61,7 +61,6 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/uno3.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -392,7 +391,7 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
void ODatabaseForm::impl_construct()
{
// aggregate a row set
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
m_xAggregate = Reference< XAggregation >( m_xContext->getServiceManager()->createInstanceWithContext(SRV_SDB_ROWSET, m_xContext), UNO_QUERY_THROW );
m_xAggregateAsRowSet.set( m_xAggregate, UNO_QUERY_THROW );
@@ -424,7 +423,7 @@ void ODatabaseForm::impl_construct()
declareForwardedProperty( PROPERTY_ID_ACTIVE_CONNECTION );
}
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
m_pGroupManager = new OGroupManager( this );
m_pGroupManager->acquire();

View File

@@ -88,7 +88,7 @@ OEditControl::OEditControl(const Reference<XComponentContext>& _rxFactory)
,m_nKeyEvent( 0 )
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
Reference<XWindow> xComp;
if (query_aggregation(m_xAggregate, xComp))
@@ -97,7 +97,7 @@ OEditControl::OEditControl(const Reference<XComponentContext>& _rxFactory)
xComp->addKeyListener(this);
}
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}

View File

@@ -35,7 +35,7 @@ OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImp
m_pCompImpl( pCompImpl )
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
// Hold a reference of the Control
{
@@ -49,7 +49,7 @@ OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImp
m_xComp->addEventListener( xEvtLstnr );
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
OComponentEventThread::~OComponentEventThread()

View File

@@ -122,12 +122,12 @@ OControl::OControl( const Reference< XComponentContext >& _rxContext, const OUSt
{
// Aggregate VCL Control
// Increment the RefCount for aggregates, because the aggregate by itself increments the RefCount in the setDelegator
increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
m_xAggregate.set(_rxContext->getServiceManager()->createInstanceWithContext(_rAggregateService, _rxContext), css::uno::UNO_QUERY);
m_xControl.set(m_xAggregate, css::uno::UNO_QUERY);
}
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
if ( _bSetDelegator )
doSetDelegator();
@@ -146,14 +146,14 @@ void OControl::doResetDelegator()
void OControl::doSetDelegator()
{
increment( m_refCount );
osl_atomic_increment( &m_refCount );
if ( m_xAggregate.is() )
{ // those brackets are important for some compilers, don't remove!
// (they ensure that the temporary object created in the line below
// is destroyed *before* the refcount-decrement)
m_xAggregate->setDelegator( static_cast< XWeak* >( this ) );
}
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}
// UNO Binding
@@ -516,7 +516,7 @@ OControlModel::OControlModel(
{
if (!_rUnoControlModelTypeName.isEmpty()) // the is a model we have to aggregate
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
m_xAggregate = Reference<XAggregation>(m_xContext->getServiceManager()->createInstanceWithContext(_rUnoControlModelTypeName, m_xContext), UNO_QUERY);
setAggregation(m_xAggregate);
@@ -539,7 +539,7 @@ OControlModel::OControlModel(
doSetDelegator();
// Refcount is at NULL again
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
}
@@ -567,7 +567,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference<
if ( _bCloneAggregate )
{
// temporarily increment refcount because of temporary references to ourself in the following
increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
// transfer the (only, at the very moment!) ref count
m_xAggregate = createAggregateClone( _pOriginal );
@@ -581,7 +581,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference<
doSetDelegator();
// decrement ref count
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}
}
@@ -604,12 +604,12 @@ void OControlModel::doResetDelegator()
void OControlModel::doSetDelegator()
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
if (m_xAggregate.is())
{
m_xAggregate->setDelegator(static_cast<XWeak*>(this));
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
// XChild
@@ -1263,14 +1263,14 @@ void OBoundControlModel::clonedFrom( const OControlModel* _pOriginal )
void OBoundControlModel::implInitAggMultiplexer( )
{
increment( m_refCount );
osl_atomic_increment( &m_refCount );
if ( m_xAggregateSet.is() )
{
m_pAggPropMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet, false );
m_pAggPropMultiplexer->acquire();
}
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
doSetDelegator();
}

View File

@@ -166,7 +166,7 @@ OFormattedControl::OFormattedControl(const Reference<XComponentContext>& _rxFact
:OBoundControl(_rxFactory, VCL_CONTROL_FORMATTEDFIELD)
,m_nKeyEvent(0)
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
Reference<XWindow> xComp;
if (query_aggregation(m_xAggregate, xComp))
@@ -174,7 +174,7 @@ OFormattedControl::OFormattedControl(const Reference<XComponentContext>& _rxFact
xComp->addKeyListener(this);
}
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
OFormattedControl::~OFormattedControl()
{
@@ -276,9 +276,9 @@ void OFormattedModel::implConstruct()
m_aNullDate = DBTypeConversion::getStandardDate();
m_nFieldType = DataType::OTHER;
// default our formats supplier
increment(m_refCount);
osl_atomic_increment(&m_refCount);
setPropertyToDefaultByHandle(PROPERTY_ID_FORMATSSUPPLIER);
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
startAggregatePropertyListening( PROPERTY_FORMATKEY );
startAggregatePropertyListening( PROPERTY_FORMATSSUPPLIER );
}

View File

@@ -69,7 +69,7 @@ InterfaceRef OFormattedFieldWrapper::createFormattedFieldWrapper(const ::com::su
pRef->m_pEditPart = rtl::Reference< OEditModel >(new OEditModel(pRef->m_xContext));
}
increment(pRef->m_refCount);
osl_atomic_increment(&pRef->m_refCount);
if (pRef->m_xAggregate.is())
{ // has to be in it's own block because of the temporary variable created by *this
@@ -77,7 +77,7 @@ InterfaceRef OFormattedFieldWrapper::createFormattedFieldWrapper(const ::com::su
}
InterfaceRef xRef(*pRef);
decrement(pRef->m_refCount);
osl_atomic_decrement(&pRef->m_refCount);
return xRef;
}
@@ -296,12 +296,12 @@ void SAL_CALL OFormattedFieldWrapper::read(const Reference<XObjectInputStream>&
}
// do the aggregation
increment(m_refCount);
osl_atomic_increment(&m_refCount);
if (m_xAggregate.is())
{ // has to be in it's own block because of the temporary variable created by *this
m_xAggregate->setDelegator(static_cast<XWeak*>(this));
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
void OFormattedFieldWrapper::ensureAggregate()
@@ -333,12 +333,12 @@ void OFormattedFieldWrapper::ensureAggregate()
}
}
increment(m_refCount);
osl_atomic_increment(&m_refCount);
if (m_xAggregate.is())
{ // has to be in it's own block because of the temporary variable created by *this
m_xAggregate->setDelegator(static_cast<XWeak*>(this));
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL

View File

@@ -21,7 +21,7 @@
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <comphelper/property.hxx>
#include <comphelper/uno3.hxx>
#include <osl/diagnose.h>
#include <tools/solar.h>
#include "property.hrc"
@@ -203,11 +203,11 @@ OGroupManager::OGroupManager(const Reference< XContainer >& _rxContainer)
:m_pCompGroup( new OGroup( OUString("AllComponentGroup") ) )
,m_xContainer(_rxContainer)
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
_rxContainer->addContainerListener(this);
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
OGroupManager::~OGroupManager()

View File

@@ -164,7 +164,7 @@ StringSequence OImageButtonControl::getSupportedServiceNames() throw(std::excep
OImageButtonControl::OImageButtonControl(const Reference<XComponentContext>& _rxFactory)
:OClickableImageBaseControl(_rxFactory, VCL_CONTROL_IMAGEBUTTON)
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
// Register as MouseListener
Reference< awt::XWindow > xComp;
@@ -172,7 +172,7 @@ OImageButtonControl::OImageButtonControl(const Reference<XComponentContext>& _rx
if (xComp.is())
xComp->addMouseListener( static_cast< awt::XMouseListener* >( this ) );
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}
// UNO Binding

View File

@@ -697,7 +697,7 @@ OImageControlControl::OImageControlControl(const Reference<XComponentContext>& _
:OBoundControl(_rxFactory, VCL_CONTROL_IMAGECONTROL)
,m_aModifyListeners( m_aMutex )
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
// Add as Focus- and MouseListener
Reference< XWindow > xComp;
@@ -705,7 +705,7 @@ OImageControlControl::OImageControlControl(const Reference<XComponentContext>& _
if ( xComp.is() )
xComp->addMouseListener( this );
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}

View File

@@ -1770,7 +1770,7 @@ namespace frm
,m_aItemListeners( m_aMutex )
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
// Register as FocusListener
Reference<XWindow> xComp;
@@ -1782,7 +1782,7 @@ namespace frm
m_xAggregateListBox->addItemListener(this);
}
// Refcount at 2 for registered Listener
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
doSetDelegator();

View File

@@ -497,7 +497,7 @@ namespace frm
void OClickableImageBaseModel::implConstruct()
{
m_pProducer = new ImageProducer;
increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
m_xProducer = m_pProducer;
@@ -507,7 +507,7 @@ namespace frm
pMultiplexer->addProperty( PROPERTY_IMAGE_URL );
}
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}

View File

@@ -142,7 +142,7 @@ namespace frm
void ORichTextModel::implDoAggregation()
{
increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
m_xAggregate = new ORichTextUnoWrapper( *m_pEngine, this );
@@ -150,7 +150,7 @@ namespace frm
doSetDelegator();
}
decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}