From f3fc127dc007f32355859ae4fc7d34916c500a18 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 7 Apr 2019 16:00:31 +0100 Subject: 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 --- package/source/xstor/ocompinstream.cxx | 2 +- package/source/xstor/owriteablestream.cxx | 2 +- package/source/xstor/xstorage.cxx | 2 +- package/source/zippackage/zipfileaccess.cxx | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'package/source') 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& ) {} -- cgit