summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-07 16:00:31 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-08 05:32:56 +0200
commitf3fc127dc007f32355859ae4fc7d34916c500a18 (patch)
tree799ee5af2c1a31c6c2243444caa932a6b2520e1b
parenttdf#124200 calc add icon for DefaultCellStyle (diff)
downloadcore-f3fc127dc007f32355859ae4fc7d34916c500a18.tar.gz
core-f3fc127dc007f32355859ae4fc7d34916c500a18.zip
Use osl_atomic_increment/osl_atomic_decrement to change m_refCount
Change-Id: Ia24441d3671102fdeeb797547396c25ee2a6ffd3 Reviewed-on: https://gerrit.libreoffice.org/70382 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx4
-rw-r--r--UnoControls/source/controls/statusindicator.cxx4
-rw-r--r--comphelper/source/container/enumhelper.cxx16
-rw-r--r--comphelper/source/misc/instancelocker.cxx2
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx2
-rw-r--r--embeddedobj/source/general/docholder.cxx6
-rw-r--r--embeddedobj/source/msole/olemisc.cxx2
-rw-r--r--package/source/xstor/ocompinstream.cxx2
-rw-r--r--package/source/xstor/owriteablestream.cxx2
-rw-r--r--package/source/xstor/xstorage.cxx2
-rw-r--r--package/source/zippackage/zipfileaccess.cxx3
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx8
-rw-r--r--sfx2/source/notify/globalevents.cxx4
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx4
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx2
-rw-r--r--svl/source/fsstor/fsstorage.cxx2
-rw-r--r--sw/source/core/unocore/unodraw.cxx4
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx4
-rw-r--r--sw/source/uibase/uiview/uivwimp.cxx4
-rw-r--r--sw/source/uibase/uno/unodispatch.cxx4
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx4
21 files changed, 43 insertions, 42 deletions
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index 23451ac5c2a9..2c728cb7ae5a 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -48,7 +48,7 @@ ProgressMonitor::ProgressMonitor( const css::uno::Reference< XComponentContext >
{
// It's not allowed to work with member in this method (refcounter !!!)
// But with a HACK (++refcount) its "OK" :-(
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
// Create instances for fixedtext, button and progress ...
@@ -94,7 +94,7 @@ ProgressMonitor::ProgressMonitor( const css::uno::Reference< XComponentContext >
m_xTopic_Bottom->setText ( PROGRESSMONITOR_DEFAULT_TOPIC );
m_xText_Bottom->setText ( PROGRESSMONITOR_DEFAULT_TEXT );
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
ProgressMonitor::~ProgressMonitor()
diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx
index c1c9d3597beb..2b6a23b9846a 100644
--- a/UnoControls/source/controls/statusindicator.cxx
+++ b/UnoControls/source/controls/statusindicator.cxx
@@ -42,7 +42,7 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >
{
// It's not allowed to work with member in this method (refcounter !!!)
// But with a HACK (++refcount) its "OK" :-(
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
// Create instances for fixedtext and progress ...
m_xText.set( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
@@ -61,7 +61,7 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >
// (progressbar take automatically its own defaults)
m_xText->setText( "" );
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
StatusIndicator::~StatusIndicator() {}
diff --git a/comphelper/source/container/enumhelper.cxx b/comphelper/source/container/enumhelper.cxx
index 41585ae24a8a..dc467bb23fa8 100644
--- a/comphelper/source/container/enumhelper.cxx
+++ b/comphelper/source/container/enumhelper.cxx
@@ -105,14 +105,14 @@ void OEnumerationByName::impl_startDisposeListening()
if (m_bListening)
return;
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
css::uno::Reference< css::lang::XComponent > xDisposable(m_xAccess, css::uno::UNO_QUERY);
if (xDisposable.is())
{
xDisposable->addEventListener(this);
m_bListening = true;
}
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
@@ -123,14 +123,14 @@ void OEnumerationByName::impl_stopDisposeListening()
if (!m_bListening)
return;
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
css::uno::Reference< css::lang::XComponent > xDisposable(m_xAccess, css::uno::UNO_QUERY);
if (xDisposable.is())
{
xDisposable->removeEventListener(this);
m_bListening = false;
}
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
OEnumerationByIndex::OEnumerationByIndex(const css::uno::Reference< css::container::XIndexAccess >& _rxAccess)
@@ -201,14 +201,14 @@ void OEnumerationByIndex::impl_startDisposeListening()
if (m_bListening)
return;
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
css::uno::Reference< css::lang::XComponent > xDisposable(m_xAccess, css::uno::UNO_QUERY);
if (xDisposable.is())
{
xDisposable->addEventListener(this);
m_bListening = true;
}
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
@@ -219,14 +219,14 @@ void OEnumerationByIndex::impl_stopDisposeListening()
if (!m_bListening)
return;
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
css::uno::Reference< css::lang::XComponent > xDisposable(m_xAccess, css::uno::UNO_QUERY);
if (xDisposable.is())
{
xDisposable->removeEventListener(this);
m_bListening = false;
}
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
OAnyEnumeration::OAnyEnumeration(const css::uno::Sequence< css::uno::Any >& lItems)
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx
index c995499d8410..cf7a2cfaf218 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -50,7 +50,7 @@ OInstanceLocker::~OInstanceLocker()
{
if ( !m_bDisposed )
{
- m_refCount++; // to call dispose
+ osl_atomic_increment(&m_refCount); // to call dispose
try {
dispose();
}
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index 912cf3a80611..48da9abdeaf7 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -261,7 +261,7 @@ OCommonEmbeddedObject::~OCommonEmbeddedObject()
{
if ( m_pInterfaceContainer || m_xDocHolder.is() )
{
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
try {
lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 75f61282fcc2..997a6105e33a 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -173,7 +173,7 @@ DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >&
m_aOutplaceFrameProps[1] <<= aArg;
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext );
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
try
{
xDesktop->addTerminateListener( this );
@@ -181,7 +181,7 @@ DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >&
catch ( const uno::Exception& )
{
}
- m_refCount--;
+ osl_atomic_decrement(&m_refCount);
aArg.Name = "ParentFrame";
aArg.Value <<= xDesktop; //TODO/LATER: should use parent document frame
@@ -191,7 +191,7 @@ DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >&
DocumentHolder::~DocumentHolder()
{
- m_refCount++; // to allow deregistration as a listener
+ osl_atomic_increment(&m_refCount); // to allow deregistration as a listener
if( m_xFrame.is() )
CloseFrame();
diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx
index 3225b7666953..9a22ec9982cb 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -142,7 +142,7 @@ OleEmbeddedObject::~OleEmbeddedObject()
if ( m_pOleComponent || m_pInterfaceContainer || m_xObjectStream.is() )
{
// the component must be cleaned during closing
- m_refCount++; // to avoid crash
+ osl_atomic_increment(&m_refCount); // to avoid crash
try {
Dispose();
} catch( const uno::Exception& ) {}
diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx
index af87464d2bf3..98592e61c590 100644
--- a/package/source/xstor/ocompinstream.cxx
+++ b/package/source/xstor/ocompinstream.cxx
@@ -67,7 +67,7 @@ OInputCompStream::~OInputCompStream()
if ( !m_bDisposed )
{
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
dispose();
}
}
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 67f152075131..ee06fc0c398c 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1668,7 +1668,7 @@ OWriteStream::~OWriteStream()
::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() );
if ( m_pImpl )
{
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
try {
dispose();
}
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 20dff2794b63..fe127883c126 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1793,7 +1793,7 @@ OStorage::~OStorage()
::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() );
if ( m_pImpl )
{
- m_refCount++; // to call dispose
+ osl_atomic_increment(&m_refCount); // to call dispose
try {
dispose();
}
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index d6cd52849735..01252838e110 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -61,7 +61,8 @@ OZipFileAccess::~OZipFileAccess()
if ( !m_bDisposed )
{
try {
- m_refCount++; // dispose will use refcounting so the further destruction must be avoided
+ // dispose will use refcounting so the further destruction must be avoided
+ osl_atomic_increment(&m_refCount);
dispose();
} catch( uno::Exception& )
{}
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index c87a185a9913..e1c0eb5dd941 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1409,12 +1409,12 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
{
// this is a hack to get m_wThis initialized; ideally there would be
// factory functions doing this but there are so many subclasses of this...
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
{
m_wThis = uno::Reference<uno::XInterface>(
static_cast<cppu::OWeakObject*>(this));
}
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
ScRange aCellRange(rR);
aCellRange.PutInOrder();
@@ -1441,12 +1441,12 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) :
{
// this is a hack to get m_wThis initialized; ideally there would be
// factory functions doing this but there are so many subclasses of this...
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
{
m_wThis = uno::Reference<uno::XInterface>(
static_cast<cppu::OWeakObject*>(this));
}
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
if (pDocShell) // Null if created with createInstance
{
diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx
index 6dd0340eb22d..cf15a8b7ff09 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ b/sfx2/source/notify/globalevents.cxx
@@ -143,10 +143,10 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const uno::Reference < uno::XCompone
, m_aLegacyListeners (m_aLock)
, m_aDocumentListeners (m_aLock)
{
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
SfxApplication::GetOrCreate();
m_xEvents = new GlobalEventConfig();
- m_refCount--;
+ osl_atomic_decrement(&m_refCount);
}
uno::Reference< container::XNameReplace > SAL_CALL SfxGlobalEvents_Impl::getEvents()
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 35411929ef53..8647dd7ea686 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -181,12 +181,12 @@ public:
, pWorkWindow( pWork )
, _nStartTime(0)
{
- ++m_refCount;
+ osl_atomic_increment(&m_refCount);
Reference< lang::XComponent > xComponent(
static_cast< ::cppu::OWeakObject* >(pController), uno::UNO_QUERY );
if (xComponent.is())
xComponent->addEventListener(this);
- --m_refCount;
+ osl_atomic_decrement(&m_refCount);
}
virtual void SAL_CALL start(const OUString& aText, sal_Int32 nRange) override;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index 1de1f56792a7..926b32e08cf8 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -140,7 +140,7 @@ OLESimpleStorage::OLESimpleStorage(
OLESimpleStorage::~OLESimpleStorage()
{
try {
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
dispose();
} catch( uno::Exception& )
{}
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index c1727b93d3cd..54b09af60142 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -102,7 +102,7 @@ FSStorage::FSStorage( const ::ucbhelper::Content& aContent,
FSStorage::~FSStorage()
{
::osl::MutexGuard aGuard( m_aMutex );
- m_refCount++; // to call dispose
+ osl_atomic_increment(&m_refCount); // to call dispose
try {
dispose();
}
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index d8be8a2b5b53..0c406018e557 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -904,10 +904,10 @@ SwXShape::SwXShape(uno::Reference<uno::XInterface> & xShape,
}
}
xShape = nullptr;
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
if( xShapeAgg.is() )
xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
- m_refCount--;
+ osl_atomic_decrement(&m_refCount);
uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
SvxShape* pShape = nullptr;
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index a0fb9e06af4d..f5d6c5c64dea 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -83,13 +83,13 @@ SwDBTreeList_Impl::~SwDBTreeList_Impl()
{
if(m_xDatabaseContext.is())
{
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
//block necessary due to solaris' compiler behaviour to
//remove temporaries at the block's end
{
m_xDatabaseContext->removeContainerListener( this );
}
- m_refCount--;
+ osl_atomic_decrement(&m_refCount);
}
}
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index 6c81a7072b73..f2d9fdcf420f 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -224,7 +224,7 @@ void SwView_Impl::Invalidate()
void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
{
//prevent removing of the non-referenced SwTransferable
- rTransferable.m_refCount++;
+ osl_atomic_increment(&rTransferable.m_refCount);
{
// Remove previously added, but no longer existing weak references.
mxTransferables.erase(std::remove_if(mxTransferables.begin(), mxTransferables.end(),
@@ -235,7 +235,7 @@ void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
mxTransferables.emplace_back(uno::Reference<lang::XUnoTunnel>(&rTransferable));
}
- rTransferable.m_refCount--;
+ osl_atomic_decrement(&rTransferable.m_refCount);
}
void SwView_Impl::StartDocumentInserter(
diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx
index 9facfa8ea404..c97431bc9c45 100644
--- a/sw/source/uibase/uno/unodispatch.cxx
+++ b/sw/source/uibase/uno/unodispatch.cxx
@@ -46,14 +46,14 @@ SwXDispatchProviderInterceptor::SwXDispatchProviderInterceptor(SwView& rVw) :
m_xIntercepted.set(xUnoFrame, uno::UNO_QUERY);
if(m_xIntercepted.is())
{
- m_refCount++;
+ osl_atomic_increment(&m_refCount);
m_xIntercepted->registerDispatchProviderInterceptor(static_cast<frame::XDispatchProviderInterceptor*>(this));
// this should make us the top-level dispatch-provider for the component, via a call to our
// setDispatchProvider we should have got an fallback for requests we (i.e. our master) cannot fulfill
uno::Reference< lang::XComponent> xInterceptedComponent(m_xIntercepted, uno::UNO_QUERY);
if (xInterceptedComponent.is())
xInterceptedComponent->addEventListener(static_cast<lang::XEventListener*>(this));
- m_refCount--;
+ osl_atomic_decrement(&m_refCount);
}
}
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index dd4b8c148d32..2be21959a05a 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -120,7 +120,7 @@ void SwXTextView::Invalidate()
mxTextViewCursor.clear();
}
- m_refCount++; //prevent second d'tor call
+ osl_atomic_increment(&m_refCount); //prevent second d'tor call
{
uno::Reference<uno::XInterface> const xInt(static_cast<
@@ -129,7 +129,7 @@ void SwXTextView::Invalidate()
m_SelChangedListeners.disposeAndClear(aEvent);
}
- m_refCount--;
+ osl_atomic_decrement(&m_refCount);
m_pView = nullptr;
}