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

@ -18,7 +18,6 @@
*/
#include <comphelper/containermultiplexer.hxx>
#include <comphelper/uno3.hxx>
#include <osl/diagnose.h>
namespace comphelper
@ -104,7 +103,7 @@ namespace comphelper
if (m_pListener)
m_pListener->setAdapter(this);
::comphelper::increment(m_refCount);
osl_atomic_increment(&m_refCount);
try
{
m_xContainer->addContainerListener(this);
@ -113,7 +112,7 @@ namespace comphelper
{
OSL_FAIL("Exception caught!");
}
::comphelper::decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}

View File

@ -546,13 +546,13 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun
,m_bCannotSelectUnfiltered( true )
{
// create the form controller aggregate
::comphelper::increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
m_pFormControllerImpl = new FormControllerImpl(this);
m_xFormControllerImpl = m_pFormControllerImpl;
m_xFormControllerImpl->setDelegator(*this);
}
::comphelper::decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
m_aInvalidateClipboard.SetTimeoutHdl(LINK(this, SbaXDataBrowserController, OnInvalidateClipboard));
m_aInvalidateClipboard.SetTimeout(300);

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 );
}

View File

@ -20,7 +20,6 @@
#ifndef INCLUDED_COMPHELPER_UNO3_HXX
#define INCLUDED_COMPHELPER_UNO3_HXX
#include <osl/interlck.h>
#include <rtl/instance.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/uno/XAggregation.hpp>
@ -30,16 +29,6 @@
namespace comphelper
{
/// manipulate ref counts without calling acquire/release
inline oslInterlockedCount increment(oslInterlockedCount& _counter) { return osl_atomic_increment(&_counter); }
inline oslInterlockedCount decrement(oslInterlockedCount& _counter) { return osl_atomic_decrement(&_counter); }
/** used for declaring UNO3-Defaults, i.e. acquire/release
*/
#define DECLARE_UNO3_DEFAULTS(classname, baseclass) \

View File

@ -18,7 +18,6 @@
*/
#include <sfx2/viewfrm.hxx>
#include <comphelper/uno3.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include <svl/smplhint.hxx>
#include <vcl/svapp.hxx>
@ -58,7 +57,7 @@ ScDispatchProviderInterceptor::ScDispatchProviderInterceptor(ScTabViewShell* pVi
m_xIntercepted.set(uno::Reference<frame::XDispatchProviderInterception>(pViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY));
if (m_xIntercepted.is())
{
comphelper::increment( m_refCount );
osl_atomic_increment( &m_refCount );
m_xIntercepted->registerDispatchProviderInterceptor(
static_cast<frame::XDispatchProviderInterceptor*>(this));
@ -68,7 +67,7 @@ ScDispatchProviderInterceptor::ScDispatchProviderInterceptor(ScTabViewShell* pVi
if (xInterceptedComponent.is())
xInterceptedComponent->addEventListener(static_cast<lang::XEventListener*>(this));
comphelper::decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}
StartListening(*pViewShell);

View File

@ -394,7 +394,7 @@ uno::Reference< uno::XAggregation> ScModelObj::GetFormatter()
{
// setDelegator veraendert den RefCount, darum eine Referenz selber halten
// (direkt am m_refCount, um sich beim release nicht selbst zu loeschen)
comphelper::increment( m_refCount );
osl_atomic_increment( &m_refCount );
// waehrend des queryInterface braucht man ein Ref auf das
// SvNumberFormatsSupplierObj, sonst wird es geloescht.
uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument().GetFormatTable() ));
@ -408,7 +408,7 @@ uno::Reference< uno::XAggregation> ScModelObj::GetFormatter()
if (xNumberAgg.is())
xNumberAgg->setDelegator( (cppu::OWeakObject*)this );
comphelper::decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
} // if ( !xNumberAgg.is() )
return xNumberAgg;
}

View File

@ -19,7 +19,7 @@
#include <sal/config.h>
#include <comphelper/uno3.hxx>
#include <comphelper/sequence.hxx>
#include <svtools/unoevent.hxx>
#include <svtools/unoimap.hxx>
#include <svx/svdobj.hxx>
@ -96,7 +96,7 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
bIsNoteCaption(false),
bInitializedNotifier(false)
{
comphelper::increment( m_refCount );
osl_atomic_increment( &m_refCount );
{
mxShapeAgg = uno::Reference<uno::XAggregation>( xShape, uno::UNO_QUERY );
@ -124,7 +124,7 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
}
}
comphelper::decrement( m_refCount );
osl_atomic_decrement( &m_refCount );
}
ScShapeObj::~ScShapeObj()

View File

@ -654,10 +654,10 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame )
m_xAttachedFrame = _pViewFrame->GetFrame().GetFrameInterface();
// to prevent deletion of this we acquire our refcounter once
::comphelper::increment(FmXFormShell_BASE::m_refCount);
osl_atomic_increment(&m_refCount);
// correct the refcounter
::comphelper::decrement(FmXFormShell_BASE::m_refCount);
osl_atomic_decrement(&m_refCount);
// cache the current configuration settings we're interested in
implAdjustConfigCache();

View File

@ -71,7 +71,6 @@
#include <comphelper/propagg.hxx>
#include <comphelper/property.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/flagguard.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/supportsservice.hxx>
@ -570,13 +569,13 @@ FormController::FormController(const Reference< css::uno::XComponentContext > &
,m_bSuspendFilterTextListening( false )
{
::comphelper::increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
m_xTabController = TabController::create( m_xComponentContext );
m_xAggregate = Reference< XAggregation >( m_xTabController, UNO_QUERY_THROW );
m_xAggregate->setDelegator( *this );
}
::comphelper::decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
m_aTabActivationIdle.SetPriority( SchedulerPriority::LOWEST );
m_aTabActivationIdle.SetIdleHdl( LINK( this, FormController, OnActivateTabOrder ) );

View File

@ -52,7 +52,7 @@ namespace svxform
{
::osl::MutexGuard aGuard( *m_pMutex );
::comphelper::increment(m_refCount);
osl_atomic_increment(&m_refCount);
if (_rxToIntercept.is())
{
_rxToIntercept->registerDispatchProviderInterceptor((XDispatchProviderInterceptor*)this);
@ -65,7 +65,7 @@ namespace svxform
m_bListening = true;
}
}
::comphelper::decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
}

View File

@ -83,7 +83,7 @@
{
OSL_ENSURE(NULL != _pAggregateInstance, "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid aggregate!");
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
m_xAggregate = _pAggregateInstance;
@ -95,7 +95,7 @@
setAggregation(m_xAggregate);
m_xAggregate->setDelegator(static_cast< XWeak* >(this));
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
registerProperties();
}
@ -113,7 +113,7 @@
,m_nStep(0)
,m_bCloneable(_rxAggregateInstance.is())
{
increment(m_refCount);
osl_atomic_increment(&m_refCount);
{
{
// ensure that the temporary gets destructed NOW
@ -128,7 +128,7 @@
setAggregation(m_xAggregate);
m_xAggregate->setDelegator(static_cast< XWeak* >(this));
}
decrement(m_refCount);
osl_atomic_decrement(&m_refCount);
registerProperties();
}