summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-04 20:31:58 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-05 13:26:36 +0100
commite07253e0262a11dc96a98598c55c43da16b9678a (patch)
tree5e803be171a4ec248ed5053258e3ea9d0a0f0e81 /svl
parent212ea275f21251903e449ba5a6b7c4fc2dc57642 (diff)
replace double-checked locking patterns with thread safe local statics
Change-Id: I4ed97cc6d9f733292156d71551d5ce3af6071445 Reviewed-on: https://gerrit.libreoffice.org/62858 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/fsstor/oinputstreamcontainer.cxx39
1 files changed, 12 insertions, 27 deletions
diff --git a/svl/source/fsstor/oinputstreamcontainer.cxx b/svl/source/fsstor/oinputstreamcontainer.cxx
index 9b9899992119..b62aca14c9b2 100644
--- a/svl/source/fsstor/oinputstreamcontainer.cxx
+++ b/svl/source/fsstor/oinputstreamcontainer.cxx
@@ -39,36 +39,21 @@ OFSInputStreamContainer::~OFSInputStreamContainer()
uno::Sequence< uno::Type > SAL_CALL OFSInputStreamContainer::getTypes()
{
- static ::cppu::OTypeCollection* pTypeCollection = nullptr ;
-
- if ( pTypeCollection == nullptr )
+ if (m_bSeekable)
{
- ::osl::MutexGuard aGuard( m_aMutex ) ;
-
- if ( pTypeCollection == nullptr )
- {
- if ( m_bSeekable )
- {
- static ::cppu::OTypeCollection aTypeCollection(
- cppu::UnoType<io::XStream>::get(),
- cppu::UnoType<io::XInputStream>::get(),
- cppu::UnoType<io::XSeekable>::get());
-
- pTypeCollection = &aTypeCollection ;
- }
- else
- {
- static ::cppu::OTypeCollection aTypeCollection(
- cppu::UnoType<io::XStream>::get(),
- cppu::UnoType<io::XInputStream>::get());
-
- pTypeCollection = &aTypeCollection ;
- }
- }
- }
+ static cppu::OTypeCollection aTypeCollection(cppu::UnoType<io::XStream>::get(),
+ cppu::UnoType<io::XInputStream>::get(),
+ cppu::UnoType<io::XSeekable>::get());
- return pTypeCollection->getTypes() ;
+ return aTypeCollection.getTypes();
+ }
+ else
+ {
+ static cppu::OTypeCollection aTypeCollection(cppu::UnoType<io::XStream>::get(),
+ cppu::UnoType<io::XInputStream>::get());
+ return aTypeCollection.getTypes();
+ }
}
uno::Any SAL_CALL OFSInputStreamContainer::queryInterface( const uno::Type& rType )