[Libreoffice-commits] core.git: binaryurp/source bridges/source canvas/source comphelper/source compilerplugins/clang cppuhelper/source cppu/source eventattacher/source framework/source i18npool/source lingucomponent/source linguistic/source oox/source package/source sax/source scripting/source sc/source sdext/source sd/source sfx2/source slideshow/source sot/source stoc/source svl/source svtools/source svx/source sw/source unotools/source unoxml/source vcl/jsdialog vcl/source vcl/unx xmlhelp/source xmloff/source xmlscript/source xmlsecurity/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 3 10:21:30 UTC 2021
binaryurp/source/outgoingrequests.cxx | 6
bridges/source/cpp_uno/shared/vtablefactory.cxx | 4
canvas/source/factory/cf_service.cxx | 2
comphelper/source/container/namecontainer.cxx | 14 +-
comphelper/source/misc/accessiblekeybindinghelper.cxx | 8 -
comphelper/source/misc/asyncnotification.cxx | 6
comphelper/source/streaming/oslfile2streamwrap.cxx | 6
comphelper/source/streaming/seekableinput.cxx | 16 +-
comphelper/source/streaming/seqinputstreamserv.cxx | 18 +-
comphelper/source/streaming/seqoutputstreamserv.cxx | 8 -
comphelper/source/streaming/seqstream.cxx | 20 +--
compilerplugins/clang/unusedvariablecheck.cxx | 2
cppu/source/uno/EnvStack.cxx | 4
cppu/source/uno/lbmap.cxx | 4
cppuhelper/source/implbase_ex.cxx | 2
cppuhelper/source/propertysetmixin.cxx | 12 -
cppuhelper/source/servicemanager.cxx | 4
cppuhelper/source/typemanager.cxx | 2
eventattacher/source/eventattacher.cxx | 16 +-
framework/source/helper/statusindicatorfactory.cxx | 34 ++---
framework/source/services/dispatchhelper.cxx | 8 -
i18npool/source/nativenumber/nativenumbersupplier.cxx | 4
i18npool/source/numberformatcode/numberformatcode.cxx | 8 -
lingucomponent/source/languageguessing/guesslang.cxx | 12 -
lingucomponent/source/numbertext/numbertext.cxx | 4
linguistic/source/misc.cxx | 4
oox/source/core/filterbase.cxx | 4
oox/source/helper/propertymap.cxx | 2
package/source/xstor/disposelistener.cxx | 4
package/source/xstor/switchpersistencestream.cxx | 28 ++--
package/source/zipapi/ByteGrabber.cxx | 14 +-
package/source/zipapi/blowfishcontext.cxx | 4
package/source/zipapi/sha1context.cxx | 8 -
sax/source/fastparser/fastparser.cxx | 6
sc/source/core/data/mtvelements.cxx | 4
sc/source/core/data/poolhelp.cxx | 2
sc/source/core/tool/editutil.cxx | 2
sc/source/core/tool/refreshtimer.cxx | 4
sc/source/filter/oox/formulabuffer.cxx | 2
scripting/source/provider/MasterScriptProvider.cxx | 2
scripting/source/provider/ProviderCache.cxx | 6
sd/source/ui/framework/configuration/ResourceFactoryManager.cxx | 8 -
sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx | 2
sdext/source/minimizer/pppoptimizertoken.cxx | 2
sdext/source/presenter/PresenterTimer.cxx | 20 +--
sfx2/source/control/thumbnailviewacc.cxx | 6
sfx2/source/doc/doctemplates.cxx | 2
slideshow/source/engine/eventqueue.cxx | 16 +-
sot/source/sdstor/ucbstorage.cxx | 14 +-
stoc/source/corereflection/lrucache.hxx | 6
stoc/source/javavm/interact.cxx | 4
stoc/source/namingservice/namingservice.cxx | 6
stoc/source/servicemanager/servicemanager.cxx | 8 -
stoc/source/simpleregistry/simpleregistry.cxx | 66 +++++-----
svl/source/config/itemholder2.cxx | 4
svl/source/misc/sharedstringpool.cxx | 8 -
svtools/source/config/itemholder2.cxx | 4
svtools/source/config/optionsdrawinglayer.cxx | 6
svtools/source/control/asynclink.cxx | 6
svtools/source/control/inettbc.cxx | 10 -
svtools/source/control/valueacc.cxx | 6
svx/source/accessibility/AccessibleTextHelper.cxx | 6
svx/source/form/ParseContext.cxx | 4
svx/source/form/fmtools.cxx | 2
svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 2
svx/source/xml/xmleohlp.cxx | 6
sw/source/core/access/acccell.cxx | 4
sw/source/core/access/acccontext.cxx | 18 +-
sw/source/core/access/accframebase.cxx | 6
sw/source/core/access/accpage.cxx | 6
sw/source/core/access/accpara.cxx | 14 +-
sw/source/core/docnode/finalthreadmanager.cxx | 12 -
unotools/source/accessibility/accessiblerelationsethelper.cxx | 10 -
unotools/source/accessibility/accessiblestatesethelper.cxx | 12 -
unotools/source/config/itemholder1.cxx | 4
unotools/source/i18n/charclass.cxx | 40 +++---
unotools/source/i18n/textsearch.cxx | 2
unotools/source/streaming/streamhelper.cxx | 12 -
unotools/source/streaming/streamwrap.cxx | 14 +-
unotools/source/ucbhelper/ucblockbytes.cxx | 8 -
unoxml/source/dom/documentbuilder.cxx | 12 -
unoxml/source/dom/saxbuilder.cxx | 28 ++--
unoxml/source/rdf/librdf_repository.cxx | 52 +++----
unoxml/source/xpath/xpathapi.cxx | 10 -
vcl/jsdialog/jsdialogbuilder.cxx | 4
vcl/source/filter/graphicfilter.cxx | 4
vcl/source/graphic/UnoGraphicObject.cxx | 4
vcl/source/helper/displayconnectiondispatch.cxx | 8 -
vcl/source/treelist/transfer2.cxx | 4
vcl/source/window/dndeventdispatcher.cxx | 12 -
vcl/unx/generic/printer/ppdparser.cxx | 2
xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 14 +-
xmlhelp/source/treeview/tvread.cxx | 2
xmloff/source/core/xmlexp.cxx | 2
xmlscript/source/xmlflat_imexp/xmlbas_export.cxx | 8 -
xmlsecurity/source/xmlsec/nss/digestcontext.cxx | 4
xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 2
97 files changed, 439 insertions(+), 439 deletions(-)
New commits:
commit 05ab38359ae72f2a54dc0b5f1b84ac5f649c507a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 3 11:36:01 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 3 12:20:53 2021 +0200
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa
Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/binaryurp/source/outgoingrequests.cxx b/binaryurp/source/outgoingrequests.cxx
index ed15e5a1bda8..3cdc80e82bb2 100644
--- a/binaryurp/source/outgoingrequests.cxx
+++ b/binaryurp/source/outgoingrequests.cxx
@@ -37,12 +37,12 @@ OutgoingRequests::~OutgoingRequests() {}
void OutgoingRequests::push(
rtl::ByteSequence const & tid, OutgoingRequest const & request)
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
map_[tid].push_back(request);
}
OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
Map::iterator i(map_.find(tid));
if (i == map_.end()) {
throw css::uno::RuntimeException(
@@ -53,7 +53,7 @@ OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
}
void OutgoingRequests::pop(rtl::ByteSequence const & tid) noexcept {
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
Map::iterator i(map_.find(tid));
assert(i != map_.end());
i->second.pop_back();
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index a74d75ed1f28..a8aa7a9c2bfa 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -214,7 +214,7 @@ VtableFactory::VtableFactory(): m_arena(
VtableFactory::~VtableFactory() {
{
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
for (const auto& rEntry : m_map) {
for (sal_Int32 j = 0; j < rEntry.second.count; ++j) {
freeBlock(rEntry.second.blocks[j]);
@@ -228,7 +228,7 @@ const VtableFactory::Vtables& VtableFactory::getVtables(
typelib_InterfaceTypeDescription * type)
{
OUString name(type->aBase.pTypeName);
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
Map::iterator i(m_map.find(name));
if (i == m_map.end()) {
GuardedBlocks blocks(*this);
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx
index 6919d56fb219..8f16ce0db008 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -288,7 +288,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
OUString const & serviceName, Sequence<Any> const & args,
Reference<XComponentContext> const & xContext ) const
{
- std::lock_guard guard(m_mutex);
+ std::scoped_lock guard(m_mutex);
// forcing last entry from impl list, if config flag set
bool bForceLastEntry(false);
diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx
index d175d25c3b37..c13ee7486e80 100644
--- a/comphelper/source/container/namecontainer.cxx
+++ b/comphelper/source/container/namecontainer.cxx
@@ -80,7 +80,7 @@ NameContainer::NameContainer( const css::uno::Type& aType )
// XNameContainer
void SAL_CALL NameContainer::insertByName( const OUString& aName, const Any& aElement )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( maProperties.find( aName ) != maProperties.end() )
throw ElementExistException();
@@ -93,7 +93,7 @@ void SAL_CALL NameContainer::insertByName( const OUString& aName, const Any& aEl
void SAL_CALL NameContainer::removeByName( const OUString& Name )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter = maProperties.find( Name );
if( aIter == maProperties.end() )
@@ -106,7 +106,7 @@ void SAL_CALL NameContainer::removeByName( const OUString& Name )
void SAL_CALL NameContainer::replaceByName( const OUString& aName, const Any& aElement )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter( maProperties.find( aName ) );
if( aIter == maProperties.end() )
@@ -122,7 +122,7 @@ void SAL_CALL NameContainer::replaceByName( const OUString& aName, const Any& aE
Any SAL_CALL NameContainer::getByName( const OUString& aName )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter = maProperties.find( aName );
if( aIter == maProperties.end() )
@@ -133,14 +133,14 @@ Any SAL_CALL NameContainer::getByName( const OUString& aName )
Sequence< OUString > SAL_CALL NameContainer::getElementNames( )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
return comphelper::mapKeysToSequence(maProperties);
}
sal_Bool SAL_CALL NameContainer::hasByName( const OUString& aName )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SvGenericNameContainerMapImpl::iterator aIter = maProperties.find( aName );
return aIter != maProperties.end();
@@ -148,7 +148,7 @@ sal_Bool SAL_CALL NameContainer::hasByName( const OUString& aName )
sal_Bool SAL_CALL NameContainer::hasElements( )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
return !maProperties.empty();
}
diff --git a/comphelper/source/misc/accessiblekeybindinghelper.cxx b/comphelper/source/misc/accessiblekeybindinghelper.cxx
index c30cb3307d48..cf16f157c5e3 100644
--- a/comphelper/source/misc/accessiblekeybindinghelper.cxx
+++ b/comphelper/source/misc/accessiblekeybindinghelper.cxx
@@ -55,7 +55,7 @@ namespace comphelper
void OAccessibleKeyBindingHelper::AddKeyBinding( const Sequence< awt::KeyStroke >& rKeyBinding )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_aKeyBindings.push_back( rKeyBinding );
}
@@ -63,7 +63,7 @@ namespace comphelper
void OAccessibleKeyBindingHelper::AddKeyBinding( const awt::KeyStroke& rKeyStroke )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_aKeyBindings.push_back( { rKeyStroke } );
}
@@ -73,7 +73,7 @@ namespace comphelper
sal_Int32 OAccessibleKeyBindingHelper::getAccessibleKeyBindingCount()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return m_aKeyBindings.size();
}
@@ -81,7 +81,7 @@ namespace comphelper
Sequence< awt::KeyStroke > OAccessibleKeyBindingHelper::getAccessibleKeyBinding( sal_Int32 nIndex )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( nIndex < 0 || nIndex >= static_cast<sal_Int32>(m_aKeyBindings.size()) )
throw IndexOutOfBoundsException();
diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx
index 1a33c5a0b331..0c7f6391db8b 100644
--- a/comphelper/source/misc/asyncnotification.cxx
+++ b/comphelper/source/misc/asyncnotification.cxx
@@ -88,7 +88,7 @@ namespace comphelper
void AsyncEventNotifierBase::removeEventsForProcessor( const ::rtl::Reference< IEventProcessor >& _xProcessor )
{
- std::lock_guard aGuard( m_xImpl->aMutex );
+ std::scoped_lock aGuard( m_xImpl->aMutex );
// remove all events for this processor
m_xImpl->aEvents.erase(std::remove_if( m_xImpl->aEvents.begin(), m_xImpl->aEvents.end(), EqualProcessor( _xProcessor ) ), m_xImpl->aEvents.end());
@@ -97,7 +97,7 @@ namespace comphelper
void SAL_CALL AsyncEventNotifierBase::terminate()
{
- std::lock_guard aGuard( m_xImpl->aMutex );
+ std::scoped_lock aGuard( m_xImpl->aMutex );
// remember the termination request
m_xImpl->bTerminate = true;
@@ -109,7 +109,7 @@ namespace comphelper
void AsyncEventNotifierBase::addEvent( const AnyEventRef& _rEvent, const ::rtl::Reference< IEventProcessor >& _xProcessor )
{
- std::lock_guard aGuard( m_xImpl->aMutex );
+ std::scoped_lock aGuard( m_xImpl->aMutex );
// remember this event
m_xImpl->aEvents.emplace_back( ProcessableEvent {_rEvent, _xProcessor} );
diff --git a/comphelper/source/streaming/oslfile2streamwrap.cxx b/comphelper/source/streaming/oslfile2streamwrap.cxx
index 472e085d642e..243634610c2b 100644
--- a/comphelper/source/streaming/oslfile2streamwrap.cxx
+++ b/comphelper/source/streaming/oslfile2streamwrap.cxx
@@ -53,7 +53,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8
aData.realloc(nBytesToRead);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
sal_uInt64 nRead = 0;
FileBase::RC eError = m_pFile->read(static_cast<void*>(aData.getArray()), nBytesToRead, nRead);
@@ -80,7 +80,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::readSomeBytes(css::uno::Sequence< sal_
void SAL_CALL OSLInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_pFile)
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
@@ -97,7 +97,7 @@ void SAL_CALL OSLInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL OSLInputStreamWrapper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_pFile)
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx
index e9291c6c9234..bd30aa354620 100644
--- a/comphelper/source/streaming/seekableinput.cxx
+++ b/comphelper/source/streaming/seekableinput.cxx
@@ -117,7 +117,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl()
sal_Int32 SAL_CALL OSeekableInputWrapper::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -130,7 +130,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readBytes( uno::Sequence< sal_Int8 >&
sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -143,7 +143,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8
void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -156,7 +156,7 @@ void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip )
sal_Int32 SAL_CALL OSeekableInputWrapper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -169,7 +169,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::available()
void SAL_CALL OSeekableInputWrapper::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -191,7 +191,7 @@ void SAL_CALL OSeekableInputWrapper::closeInput()
void SAL_CALL OSeekableInputWrapper::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -204,7 +204,7 @@ void SAL_CALL OSeekableInputWrapper::seek( sal_Int64 location )
sal_Int64 SAL_CALL OSeekableInputWrapper::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
@@ -217,7 +217,7 @@ sal_Int64 SAL_CALL OSeekableInputWrapper::getPosition()
sal_Int64 SAL_CALL OSeekableInputWrapper::getLength()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOriginalStream.is() )
throw io::NotConnectedException();
diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx
index d729fa7999c9..25596f17473c 100644
--- a/comphelper/source/streaming/seqinputstreamserv.cxx
+++ b/comphelper/source/streaming/seqinputstreamserv.cxx
@@ -103,7 +103,7 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi
// css::io::XInputStream:
::sal_Int32 SAL_CALL SequenceInputStreamService::readBytes( uno::Sequence< ::sal_Int8 > & aData, ::sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -112,7 +112,7 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi
::sal_Int32 SAL_CALL SequenceInputStreamService::readSomeBytes( uno::Sequence< ::sal_Int8 > & aData, ::sal_Int32 nMaxBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -121,7 +121,7 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi
void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -130,7 +130,7 @@ void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip )
::sal_Int32 SAL_CALL SequenceInputStreamService::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -139,7 +139,7 @@ void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip )
void SAL_CALL SequenceInputStreamService::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xInputStream.is() )
throw io::NotConnectedException();
@@ -151,7 +151,7 @@ void SAL_CALL SequenceInputStreamService::closeInput()
// css::io::XSeekable:
void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xSeekable.is() )
throw io::NotConnectedException();
@@ -160,7 +160,7 @@ void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SequenceInputStreamService::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xSeekable.is() )
throw io::NotConnectedException();
@@ -169,7 +169,7 @@ void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SequenceInputStreamService::getLength()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xSeekable.is() )
throw io::NotConnectedException();
@@ -179,7 +179,7 @@ void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location )
// css::lang::XInitialization:
void SAL_CALL SequenceInputStreamService::initialize( const uno::Sequence< css::uno::Any > & aArguments )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_bInitialized )
throw frame::DoubleInitializationException();
diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx
index e19ea1001ae8..d1ffc4df2d42 100644
--- a/comphelper/source/streaming/seqoutputstreamserv.cxx
+++ b/comphelper/source/streaming/seqoutputstreamserv.cxx
@@ -90,7 +90,7 @@ uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService::getSupportedServ
// css::io::XOutputStream:
void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence< ::sal_Int8 > & aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
@@ -99,7 +99,7 @@ void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence< ::sa
void SAL_CALL SequenceOutputStreamService::flush()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
@@ -108,7 +108,7 @@ void SAL_CALL SequenceOutputStreamService::flush()
void SAL_CALL SequenceOutputStreamService::closeOutput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
@@ -119,7 +119,7 @@ void SAL_CALL SequenceOutputStreamService::closeOutput()
// css::io::XSequenceOutputStream:
uno::Sequence< ::sal_Int8 > SAL_CALL SequenceOutputStreamService::getWrittenBytes()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_xOutputStream.is() )
throw io::NotConnectedException();
diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx
index 9ad5db7254b8..db39a1dc30e8 100644
--- a/comphelper/source/streaming/seqstream.cxx
+++ b/comphelper/source/streaming/seqstream.cxx
@@ -60,7 +60,7 @@ sal_Int32 SAL_CALL SequenceInputStream::readBytes( Sequence<sal_Int8>& aData, sa
if (nBytesToRead < 0)
throw BufferSizeExceededException(OUString(),*this);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
sal_Int32 nAvail = avail();
@@ -87,7 +87,7 @@ void SAL_CALL SequenceInputStream::skipBytes( sal_Int32 nBytesToSkip )
if (nBytesToSkip < 0)
throw BufferSizeExceededException(OUString(),*this);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
sal_Int32 nAvail = avail();
@@ -100,7 +100,7 @@ void SAL_CALL SequenceInputStream::skipBytes( sal_Int32 nBytesToSkip )
sal_Int32 SAL_CALL SequenceInputStream::available( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return avail();
}
@@ -108,7 +108,7 @@ sal_Int32 SAL_CALL SequenceInputStream::available( )
void SAL_CALL SequenceInputStream::closeInput( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (m_nPos == -1)
throw NotConnectedException(OUString(), *this);
@@ -120,19 +120,19 @@ void SAL_CALL SequenceInputStream::seek( sal_Int64 location )
{
if ( location > m_aData.getLength() || location < 0 || location > SAL_MAX_INT32 )
throw IllegalArgumentException("bad location", static_cast<cppu::OWeakObject*>(this), 1);
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_nPos = static_cast<sal_Int32>(location);
}
sal_Int64 SAL_CALL SequenceInputStream::getPosition()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return m_nPos;
}
sal_Int64 SAL_CALL SequenceInputStream::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return m_aData.getLength();
}
@@ -153,7 +153,7 @@ OSequenceOutputStream::OSequenceOutputStream(Sequence< sal_Int8 >& _rSeq, double
void SAL_CALL OSequenceOutputStream::writeBytes( const Sequence< sal_Int8 >& _rData )
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!m_bConnected)
throw NotConnectedException();
@@ -193,7 +193,7 @@ void SAL_CALL OSequenceOutputStream::writeBytes( const Sequence< sal_Int8 >& _rD
void SAL_CALL OSequenceOutputStream::flush( )
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!m_bConnected)
throw NotConnectedException();
@@ -211,7 +211,7 @@ void OSequenceOutputStream::finalizeOutput()
void SAL_CALL OSequenceOutputStream::closeOutput()
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
if (!m_bConnected)
throw NotConnectedException();
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index 10354192d6f3..1e09645733e0 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -27,7 +27,7 @@ Check for unused classes where the compiler cannot decide (e.g. because of
non-trivial or extern ctors) if a variable is unused if only its ctor/dtor
are called and nothing else. For example std::vector is a class where
the ctor may call further functions, but an unused std::string variable
-does nothing. On the other hand, std::lock_guard instances are used
+does nothing. On the other hand, std::scoped_lock instances are used
for their dtors and so are not unused even if not otherwise accessed.
Classes which are safe to be warned about need to be marked using
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index 033f9d94ce3f..2356948c51c5 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -76,7 +76,7 @@ static void s_setCurrent(uno_Environment * pEnv)
{
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
- std::lock_guard guard(s_threadMap_mutex);
+ std::scoped_lock guard(s_threadMap_mutex);
if (pEnv)
{
s_threadMap[threadId] = pEnv;
@@ -95,7 +95,7 @@ static uno_Environment * s_getCurrent()
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
- std::lock_guard guard(s_threadMap_mutex);
+ std::scoped_lock guard(s_threadMap_mutex);
ThreadMap::iterator iEnv = s_threadMap.find(threadId);
if(iEnv != s_threadMap.end())
pEnv = iEnv->second;
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index a39eb409a765..a88259627b2c 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -319,7 +319,7 @@ static OUString getBridgeName(
static void setNegativeBridge( const OUString & rBridgeName )
{
MappingsData & rData = getMappingsData();
- std::lock_guard aGuard( rData.aNegativeLibsMutex );
+ std::scoped_lock aGuard( rData.aNegativeLibsMutex );
rData.aNegativeLibs.insert( rBridgeName );
}
@@ -356,7 +356,7 @@ static bool loadModule(osl::Module & rModule, const OUString & rBridgeName)
bool bNeg;
{
MappingsData & rData = getMappingsData();
- std::lock_guard aGuard( rData.aNegativeLibsMutex );
+ std::scoped_lock aGuard( rData.aNegativeLibsMutex );
const auto iFind( rData.aNegativeLibs.find( rBridgeName ) );
bNeg = (iFind != rData.aNegativeLibs.end());
}
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx
index 24b7a74582d7..4ced30adbe5c 100644
--- a/cppuhelper/source/implbase_ex.cxx
+++ b/cppuhelper/source/implbase_ex.cxx
@@ -68,7 +68,7 @@ static type_entry * getTypeEntries( class_data * cd )
if (! cd->m_storedTypeRefs) // not inited?
{
static std::mutex aMutex;
- std::lock_guard guard( aMutex );
+ std::scoped_lock guard( aMutex );
if (! cd->m_storedTypeRefs) // not inited?
{
// get all types
diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx
index 0a270db6f17e..41f9442ff311 100644
--- a/cppuhelper/source/propertysetmixin.cxx
+++ b/cppuhelper/source/propertysetmixin.cxx
@@ -853,7 +853,7 @@ void PropertySetMixinImpl::prepareSet(
Impl::VetoListenerBag specificVeto;
Impl::VetoListenerBag unspecificVeto;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
if (m_impl->disposed) {
throw css::lang::DisposedException(
"disposed", static_cast< css::beans::XPropertySet * >(this));
@@ -922,7 +922,7 @@ void PropertySetMixinImpl::dispose() {
Impl::BoundListenerMap boundListeners;
Impl::VetoListenerMap vetoListeners;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
boundListeners.swap(m_impl->boundListeners);
vetoListeners.swap(m_impl->vetoListeners);
m_impl->disposed = true;
@@ -1001,7 +1001,7 @@ void PropertySetMixinImpl::addPropertyChangeListener(
checkUnknown(propertyName);
bool disposed;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
disposed = m_impl->disposed;
if (!disposed) {
m_impl->boundListeners[propertyName].insert(listener);
@@ -1020,7 +1020,7 @@ void PropertySetMixinImpl::removePropertyChangeListener(
{
assert(listener.is());
checkUnknown(propertyName);
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
Impl::BoundListenerMap::iterator i(
m_impl->boundListeners.find(propertyName));
if (i != m_impl->boundListeners.end()) {
@@ -1040,7 +1040,7 @@ void PropertySetMixinImpl::addVetoableChangeListener(
checkUnknown(propertyName);
bool disposed;
{
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
disposed = m_impl->disposed;
if (!disposed) {
m_impl->vetoListeners[propertyName].insert(listener);
@@ -1059,7 +1059,7 @@ void PropertySetMixinImpl::removeVetoableChangeListener(
{
assert(listener.is());
checkUnknown(propertyName);
- std::lock_guard g(m_impl->mutex);
+ std::scoped_lock g(m_impl->mutex);
Impl::VetoListenerMap::iterator i(m_impl->vetoListeners.find(propertyName));
if (i != m_impl->vetoListeners.end()) {
Impl::VetoListenerBag::iterator j(i->second.find(listener));
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index bf8e13fcc53e..6cabae88f0dc 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -470,13 +470,13 @@ private:
sal_Bool ContentEnumeration::hasMoreElements()
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
return iterator_ != factories_.end();
}
css::uno::Any ContentEnumeration::nextElement()
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (iterator_ == factories_.end()) {
throw css::container::NoSuchElementException(
"Bootstrap service manager service enumerator has no more elements",
diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx
index b97d36d16aed..12c25ddc92bc 100644
--- a/cppuhelper/source/typemanager.cxx
+++ b/cppuhelper/source/typemanager.cxx
@@ -1679,7 +1679,7 @@ Enumeration::nextTypeDescription()
{
OUString name;
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (positions_.empty()) {
throw css::container::NoSuchElementException(
"exhausted XTypeDescriptionEnumeration",
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index b7988dbeff7b..348e8d54f791 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -305,7 +305,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xALAS;
if( xALAS.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xInvocationAdapterFactory = xALAS;
}
// Introspection service ?
@@ -313,7 +313,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xI;
if( xI.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xIntrospection = xI;
}
// Reflection service ?
@@ -321,7 +321,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xIdlR;
if( xIdlR.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xReflection = xIdlR;
}
// Converter Service ?
@@ -329,7 +329,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
arg >>= xC;
if( xC.is() )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_xConverter = xC;
}
@@ -343,7 +343,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
//*** Private helper methods ***
Reference< XIntrospection > EventAttacherImpl::getIntrospection()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xIntrospection.is() )
{
m_xIntrospection = theIntrospection::get( m_xContext );
@@ -355,7 +355,7 @@ Reference< XIntrospection > EventAttacherImpl::getIntrospection()
//*** Private helper methods ***
Reference< XIdlReflection > EventAttacherImpl::getReflection()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xReflection.is() )
{
m_xReflection = theCoreReflection::get(m_xContext);
@@ -367,7 +367,7 @@ Reference< XIdlReflection > EventAttacherImpl::getReflection()
//*** Private helper methods ***
Reference< XInvocationAdapterFactory2 > EventAttacherImpl::getInvocationAdapterService()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xInvocationAdapterFactory.is() )
{
m_xInvocationAdapterFactory = InvocationAdapterFactory::create(m_xContext);
@@ -379,7 +379,7 @@ Reference< XInvocationAdapterFactory2 > EventAttacherImpl::getInvocationAdapterS
//*** Private helper methods ***
Reference< XTypeConverter > EventAttacherImpl::getConverter()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if( !m_xConverter.is() )
{
m_xConverter = Converter::create(m_xContext);
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 702436b1dc61..45c96b373f1a 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -66,7 +66,7 @@ StatusIndicatorFactory::~StatusIndicatorFactory()
void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
{
if (lArguments.hasElements()) {
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
css::uno::Reference< css::frame::XFrame > xTmpFrame;
css::uno::Reference< css::awt::XWindow > xTmpWindow;
@@ -103,7 +103,7 @@ css::uno::Reference< css::task::XStatusIndicator > SAL_CALL StatusIndicatorFacto
void SAL_CALL StatusIndicatorFactory::update()
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_bAllowReschedule = true;
}
@@ -114,7 +114,7 @@ void StatusIndicatorFactory::start(const css::uno::Reference< css::task::XStatus
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
// create new info structure for this child or move it to the front of our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
@@ -143,7 +143,7 @@ void StatusIndicatorFactory::reset(const css::uno::Reference< css::task::XStatus
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
// reset the internal info structure related to this child
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
@@ -177,7 +177,7 @@ void StatusIndicatorFactory::end(const css::uno::Reference< css::task::XStatusIn
sal_Int32 nValue = 0;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
// remove this child from our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
@@ -231,7 +231,7 @@ void StatusIndicatorFactory::setText(const css::uno::Reference< css::task::XStat
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
@@ -263,7 +263,7 @@ void StatusIndicatorFactory::setValue( const css::uno::Reference< css::task::XSt
css::uno::Reference< css::task::XStatusIndicator > xProgress;
// SAFE -> ----------------------------------
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
@@ -296,7 +296,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
css::uno::Reference< css::uno::XComponentContext > xContext;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
if (!m_bAllowParentShow)
return;
@@ -390,7 +390,7 @@ void StatusIndicatorFactory::impl_createProgress()
css::uno::Reference< css::awt::XWindow > xWindow;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xFrame = m_xFrame;
xWindow = m_xPluggWindow;
@@ -427,7 +427,7 @@ void StatusIndicatorFactory::impl_createProgress()
}
}
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_xProgress = xProgress;
}
@@ -436,7 +436,7 @@ void StatusIndicatorFactory::impl_showProgress()
css::uno::Reference< css::frame::XFrame > xFrame;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xFrame = m_xFrame;
}
@@ -468,7 +468,7 @@ void StatusIndicatorFactory::impl_showProgress()
}
}
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_xProgress = xProgress;
}
@@ -477,7 +477,7 @@ void StatusIndicatorFactory::impl_hideProgress()
css::uno::Reference< css::frame::XFrame > xFrame;
// SAFE -> ----------------------------------
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xFrame = m_xFrame;
}
@@ -501,7 +501,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
{
// SAFE ->
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
if (m_bDisableReschedule)
return;
}
@@ -510,7 +510,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
bool bReschedule = bForce;
if (!bReschedule)
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
bReschedule = m_bAllowReschedule;
m_bAllowReschedule = false;
}
@@ -540,7 +540,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
void StatusIndicatorFactory::impl_startWakeUpThread()
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
if (m_bDisableReschedule)
return;
@@ -556,7 +556,7 @@ void StatusIndicatorFactory::impl_stopWakeUpThread()
{
rtl::Reference<WakeUpThread> wakeUp;
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
std::swap(wakeUp, m_pWakeUp);
}
if (wakeUp.is())
diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx
index cfa4a8a2bbe1..30e424df94ff 100644
--- a/framework/source/services/dispatchhelper.cxx
+++ b/framework/source/services/dispatchhelper.cxx
@@ -95,7 +95,7 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
css::uno::Reference<css::util::XURLTransformer> xParser;
/* SAFE { */
{
- std::lock_guard aReadLock(m_mutex);
+ std::scoped_lock aReadLock(m_mutex);
xParser = css::util::URLTransformer::create(m_xContext);
}
/* } SAFE */
@@ -150,7 +150,7 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch>
css::uno::UNO_QUERY);
/* SAFE { */
{
- std::lock_guard aWriteLock(m_mutex);
+ std::scoped_lock aWriteLock(m_mutex);
m_xBroadcaster = xNotifyDispatch;
m_aBlockFlag = false;
}
@@ -184,7 +184,7 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch>
*/
void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultEvent& aResult)
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_aResult <<= aResult;
m_aBlockFlag = true;
m_aBlock.notify_one();
@@ -198,7 +198,7 @@ void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultE
*/
void SAL_CALL DispatchHelper::disposing(const css::lang::EventObject&)
{
- std::lock_guard g(m_mutex);
+ std::scoped_lock g(m_mutex);
m_aResult.clear();
m_aBlockFlag = true;
m_aBlock.notify_one();
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index b337fc50f2c6..8e2f9128a685 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -554,7 +554,7 @@ struct Separators
Separators getLocaleSeparators(const Locale& rLocale, const OUString& rLocStr)
{
// Guard the static variable below.
- std::lock_guard aGuard(theNatNumMutex);
+ std::scoped_lock aGuard(theNatNumMutex);
// Maximum a couple hundred of pairs with 4-byte structs - so no need for smart managing
static std::unordered_map<OUString, Separators> aLocaleSeparatorsBuf;
auto it = aLocaleSeparatorsBuf.find(rLocStr);
@@ -603,7 +603,7 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
= css::linguistic2::NumberText::create(comphelper::getProcessComponentContext());
// Guard the static variables below.
- std::lock_guard aGuard( theNatNumMutex );
+ std::scoped_lock aGuard( theNatNumMutex );
OUString numbertext_prefix;
// default "cardinal" gets empty prefix
diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx
index 0e76f087b02f..c20ed5b20edc 100644
--- a/i18npool/source/numberformatcode/numberformatcode.cxx
+++ b/i18npool/source/numberformatcode/numberformatcode.cxx
@@ -43,7 +43,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage,
OUString elementType = mapElementTypeShortToString(formatType);
OUString elementUsage = mapElementUsageShortToString(formatUsage);
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
auto pFormat = std::find_if(aFormatSeq.begin(), aFormatSeq.end(),
@@ -67,7 +67,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage,
css::i18n::NumberFormatCode SAL_CALL
NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::Locale& rLocale )
{
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
auto pFormat = std::find_if(aFormatSeq.begin(), aFormatSeq.end(),
@@ -88,7 +88,7 @@ NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::L
css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL
NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang::Locale& rLocale )
{
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
std::vector<css::i18n::NumberFormatCode> aVec;
@@ -113,7 +113,7 @@ NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang
css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL
NumberFormatCodeMapper::getAllFormatCodes( const css::lang::Locale& rLocale )
{
- std::lock_guard g(maMutex);
+ std::scoped_lock g(maMutex);
const css::uno::Sequence< css::i18n::FormatElement > &aFormatSeq = getFormats( rLocale );
std::vector<css::i18n::NumberFormatCode> aVec;
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx
index 98274af16d46..987642538f0e 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -161,7 +161,7 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage(
::sal_Int32 nStartPos,
::sal_Int32 nLen )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -190,7 +190,7 @@ void LangGuess_Impl::SetFingerPrintsDB(
uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getAvailableLanguages( )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -212,7 +212,7 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getAvailableLanguages( )
uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getEnabledLanguages( )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -234,7 +234,7 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getEnabledLanguages( )
uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getDisabledLanguages( )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -257,7 +257,7 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getDisabledLanguages( )
void SAL_CALL LangGuess_Impl::disableLanguages(
const uno::Sequence< Locale >& rLanguages )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
@@ -278,7 +278,7 @@ void SAL_CALL LangGuess_Impl::disableLanguages(
void SAL_CALL LangGuess_Impl::enableLanguages(
const uno::Sequence< Locale >& rLanguages )
{
- std::lock_guard aGuard( GetLangGuessMutex() );
+ std::scoped_lock aGuard( GetLangGuessMutex() );
EnsureInitialized();
diff --git a/lingucomponent/source/numbertext/numbertext.cxx b/lingucomponent/source/numbertext/numbertext.cxx
index 5b9a32a65196..f878a55f591c 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -112,7 +112,7 @@ void NumberText_Impl::EnsureInitialized()
OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale& rLocale)
{
- std::lock_guard aGuard(GetNumberTextMutex());
+ std::scoped_lock aGuard(GetNumberTextMutex());
EnsureInitialized();
// libnumbertext supports Language + Country tags (separated by "_" or "-")
LanguageTag aLanguageTag(rLocale);
@@ -142,7 +142,7 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Lo
uno::Sequence<Locale> SAL_CALL NumberText_Impl::getAvailableLanguages()
{
- std::lock_guard aGuard(GetNumberTextMutex());
+ std::scoped_lock aGuard(GetNumberTextMutex());
// TODO
Sequence<css::lang::Locale> aRes;
return aRes;
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index ac9ad9de37e9..363b5f445a47 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -576,7 +576,7 @@ static std::mutex s_GetCharClassMutex;
bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageType nLanguage )
{
- std::lock_guard aGuard( s_GetCharClassMutex );
+ std::scoped_lock aGuard( s_GetCharClassMutex );
CharClass &rCC = lcl_GetCharClass();
rCC.setLanguageTag( LanguageTag( nLanguage ));
@@ -612,7 +612,7 @@ CapType capitalType(const OUString& aTerm, CharClass const * pCC)
OUString ToLower( const OUString &rText, LanguageType nLanguage )
{
- std::lock_guard aGuard( s_GetCharClassMutex );
+ std::scoped_lock aGuard( s_GetCharClassMutex );
CharClass &rCC = lcl_GetCharClass();
rCC.setLanguageTag( LanguageTag( nLanguage ));
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 7dd362a32954..ea22d1fbb8bc 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -93,7 +93,7 @@ private:
DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
{
UrlPool& rUrlPool = StaticUrlPool::get();
- std::lock_guard aGuard( rUrlPool.maMutex );
+ std::scoped_lock aGuard( rUrlPool.maMutex );
mbValid = rUrl.isEmpty() || (rUrlPool.maUrls.count( rUrl ) == 0);
if( mbValid && !rUrl.isEmpty() )
{
@@ -105,7 +105,7 @@ DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
DocumentOpenedGuard::~DocumentOpenedGuard()
{
UrlPool& rUrlPool = StaticUrlPool::get();
- std::lock_guard aGuard( rUrlPool.maMutex );
+ std::scoped_lock aGuard( rUrlPool.maMutex );
if( !maUrl.isEmpty() )
rUrlPool.maUrls.erase( maUrl );
}
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index e069efe3c537..afb6ef6ff6f6 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -125,7 +125,7 @@ Reference< XPropertySetInfo > SAL_CALL GenericPropertySet::getPropertySetInfo()
void SAL_CALL GenericPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
{
- std::lock_guard aGuard( mMutex );
+ std::scoped_lock aGuard( mMutex );
maPropMap[ rPropertyName ] = rValue;
}
diff --git a/package/source/xstor/disposelistener.cxx b/package/source/xstor/disposelistener.cxx
index ab30f99ca129..b7ee40957465 100644
--- a/package/source/xstor/disposelistener.cxx
+++ b/package/source/xstor/disposelistener.cxx
@@ -31,13 +31,13 @@ OChildDispListener_Impl::~OChildDispListener_Impl()
void OChildDispListener_Impl::OwnerIsDisposed()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_pStorage = nullptr;
}
void SAL_CALL OChildDispListener_Impl::disposing( const lang::EventObject& Source )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
// ObjectIsDisposed must not contain any locking!
if ( m_pStorage && Source.Source.is() )
m_pStorage->ChildIsDisposed( Source.Source );
diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx
index e646a3f06245..ff9828a72b91 100644
--- a/package/source/xstor/switchpersistencestream.cxx
+++ b/package/source/xstor/switchpersistencestream.cxx
@@ -200,7 +200,7 @@ void SwitchablePersistenceStream::CloseAll_Impl()
// css::io::XStream
uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInputStream( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_pStreamData )
m_pStreamData->m_bInOpen = true;
@@ -209,7 +209,7 @@ uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInpu
uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOutputStream( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( m_pStreamData )
m_pStreamData->m_bOutOpen = true;
@@ -219,7 +219,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut
// css::io::XInputStream
::sal_Int32 SAL_CALL SwitchablePersistenceStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -233,7 +233,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut
::sal_Int32 SAL_CALL SwitchablePersistenceStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -247,7 +247,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut
void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -261,7 +261,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip )
::sal_Int32 SAL_CALL SwitchablePersistenceStream::available( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -275,7 +275,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip )
void SAL_CALL SwitchablePersistenceStream::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -288,7 +288,7 @@ void SAL_CALL SwitchablePersistenceStream::closeInput()
// css::io::XOutputStream
void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -305,7 +305,7 @@ void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sa
void SAL_CALL SwitchablePersistenceStream::flush( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData || m_pStreamData->m_bInStreamBased )
{
@@ -325,7 +325,7 @@ void SAL_CALL SwitchablePersistenceStream::flush( )
void SAL_CALL SwitchablePersistenceStream::closeOutput( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -338,7 +338,7 @@ void SAL_CALL SwitchablePersistenceStream::closeOutput( )
// css::io::XTruncate
void SAL_CALL SwitchablePersistenceStream::truncate( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -356,7 +356,7 @@ void SAL_CALL SwitchablePersistenceStream::truncate( )
// css::io::XSeekable
void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -370,7 +370,7 @@ void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SwitchablePersistenceStream::getPosition( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
@@ -384,7 +384,7 @@ void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location )
::sal_Int64 SAL_CALL SwitchablePersistenceStream::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pStreamData )
throw io::NotConnectedException();
diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx
index 3b039e5000b1..89ce1af5634b 100644
--- a/package/source/zipapi/ByteGrabber.cxx
+++ b/package/source/zipapi/ByteGrabber.cxx
@@ -48,7 +48,7 @@ ByteGrabber::~ByteGrabber()
void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNewStream)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
xStream = xNewStream;
xSeek.set(xNewStream, uno::UNO_QUERY);
}
@@ -57,14 +57,14 @@ void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNe
sal_Int32 ByteGrabber::readBytes( uno::Sequence< sal_Int8 >& aData,
sal_Int32 nBytesToRead )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
return xStream->readBytes(aData, nBytesToRead );
}
// XSeekable chained...
void ByteGrabber::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!xSeek.is() )
throw io::IOException(THROW_WHERE );
@@ -76,7 +76,7 @@ void ByteGrabber::seek( sal_Int64 location )
sal_Int64 ByteGrabber::getPosition( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!xSeek.is() )
throw io::IOException(THROW_WHERE );
@@ -85,7 +85,7 @@ sal_Int64 ByteGrabber::getPosition( )
sal_Int64 ByteGrabber::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!xSeek.is() )
throw io::IOException(THROW_WHERE );
@@ -94,7 +94,7 @@ sal_Int64 ByteGrabber::getLength( )
sal_uInt16 ByteGrabber::ReadUInt16()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (xStream->readBytes(aSequence, 2) != 2)
return 0;
@@ -107,7 +107,7 @@ sal_uInt16 ByteGrabber::ReadUInt16()
sal_uInt32 ByteGrabber::ReadUInt32()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (xStream->readBytes(aSequence, 4) != 4)
return 0;
diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx
index d11a9f0d3c01..1b5ed4a14893 100644
--- a/package/source/zipapi/blowfishcontext.cxx
+++ b/package/source/zipapi/blowfishcontext.cxx
@@ -62,7 +62,7 @@ BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext()
uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pCipher )
throw lang::DisposedException();
@@ -96,7 +96,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC
uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pCipher )
throw lang::DisposedException();
diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx
index 0da0648ea206..4b6cbd2d339d 100644
--- a/package/source/zipapi/sha1context.cxx
+++ b/package/source/zipapi/sha1context.cxx
@@ -49,7 +49,7 @@ StarOfficeSHA1DigestContext::~StarOfficeSHA1DigestContext()
void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& aData)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pDigest )
throw lang::DisposedException();
@@ -64,7 +64,7 @@ void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sa
uno::Sequence<::sal_Int8> SAL_CALL StarOfficeSHA1DigestContext::finalizeDigestAndDispose()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if ( !m_pDigest )
throw lang::DisposedException();
@@ -98,7 +98,7 @@ CorrectSHA1DigestContext::~CorrectSHA1DigestContext()
void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& rData)
{
- std::lock_guard aGuard(m_Mutex);
+ std::scoped_lock aGuard(m_Mutex);
if (m_bDisposed)
throw lang::DisposedException();
@@ -107,7 +107,7 @@ void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_I
uno::Sequence<::sal_Int8> SAL_CALL CorrectSHA1DigestContext::finalizeDigestAndDispose()
{
- std::lock_guard aGuard(m_Mutex);
+ std::scoped_lock aGuard(m_Mutex);
if (m_bDisposed)
throw lang::DisposedException();
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 980c092c796e..05a874cb3c33 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -601,7 +601,7 @@ void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumen
// Error during parsing !
Any savedException;
{
- std::lock_guard g(maSavedExceptionMutex);
+ std::scoped_lock g(maSavedExceptionMutex);
if (maSavedException.hasValue())
{
savedException.setValue(&maSavedException, cppu::UnoType<decltype(maSavedException)>::get());
@@ -643,7 +643,7 @@ void Entity::saveException( const Any & e )
// unexpectedly some 'startElements' produce a UNO_QUERY_THROW
// for XComponent; and yet expect to continue parsing.
SAL_WARN("sax", "Unexpected exception from XML parser " << exceptionToString(e));
- std::lock_guard g(maSavedExceptionMutex);
+ std::scoped_lock g(maSavedExceptionMutex);
if (maSavedException.hasValue())
{
SAL_INFO("sax.fastparser", "discarding exception, already have one");
@@ -656,7 +656,7 @@ void Entity::saveException( const Any & e )
bool Entity::hasException()
{
- std::lock_guard g(maSavedExceptionMutex);
+ std::scoped_lock g(maSavedExceptionMutex);
return maSavedException.hasValue();
}
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
index 865d37bf2933..c7d7e52bfccf 100644
--- a/sc/source/core/data/mtvelements.cxx
+++ b/sc/source/core/data/mtvelements.cxx
@@ -55,7 +55,7 @@ ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument& rDoc) : mrDoc(rDoc) {
ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL nCol)
{
- std::lock_guard aGuard(maMtxTables);
+ std::scoped_lock aGuard(maMtxTables);
TablesType::iterator itTab = maTables.find(nTab);
if (itTab == maTables.end())
@@ -93,7 +93,7 @@ ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL
void ColumnBlockPositionSet::clear()
{
- std::lock_guard aGuard(maMtxTables);
+ std::scoped_lock aGuard(maMtxTables);
maTables.clear();
}
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 71cfa4eaf4ff..bf495c06c337 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -91,7 +91,7 @@ std::unique_ptr<SvNumberFormatter> ScPoolHelper::CreateNumberFormatter() const
{
std::unique_ptr<SvNumberFormatter> p;
{
- std::lock_guard aGuard(maMtxCreateNumFormatter);
+ std::scoped_lock aGuard(maMtxCreateNumFormatter);
p.reset(new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM));
}
p->SetColorLink( LINK(&m_rSourceDoc, ScDocument, GetUserDefinedColor) );
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 63cbfe5736f0..3dd1b70e20f8 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -115,7 +115,7 @@ OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocumen
return GetMultilineString( rEditText );
static std::mutex aMutex;
- std::lock_guard aGuard( aMutex);
+ std::scoped_lock aGuard( aMutex);
// ScFieldEditEngine is needed to resolve field contents.
if (pDoc)
{
diff --git a/sc/source/core/tool/refreshtimer.cxx b/sc/source/core/tool/refreshtimer.cxx
index 35c8eace9b40..bd1e0447d7a6 100644
--- a/sc/source/core/tool/refreshtimer.cxx
+++ b/sc/source/core/tool/refreshtimer.cxx
@@ -36,7 +36,7 @@ ScRefreshTimerProtector::ScRefreshTimerProtector( std::unique_ptr<ScRefreshTimer
{
m_rpControl->SetAllowRefresh( false );
// wait for any running refresh in another thread to finish
- std::lock_guard aGuard( m_rpControl->GetMutex() );
+ std::scoped_lock aGuard( m_rpControl->GetMutex() );
}
}
@@ -122,7 +122,7 @@ void ScRefreshTimer::Invoke()
if ( ppControl && *ppControl && (*ppControl)->IsRefreshAllowed() )
{
// now we COULD make the call in another thread ...
- std::lock_guard aGuard( (*ppControl)->GetMutex() );
+ std::scoped_lock aGuard( (*ppControl)->GetMutex() );
Timer::Invoke();
// restart from now on, don't execute immediately again if timed out
// a second time during refresh
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 40470d0bc966..a93043830892 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -398,7 +398,7 @@ void FormulaBuffer::finalizeImport()
FormulaBuffer::SheetItem FormulaBuffer::getSheetItem( SCTAB nTab )
{
- std::lock_guard aGuard(maMtxData);
+ std::scoped_lock aGuard(maMtxData);
SheetItem aItem;
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index e8719c8cb4aa..57cc596a7878 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -335,7 +335,7 @@ MasterScriptProvider::providerCache()
{
if ( !m_pPCache )
{
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
if ( !m_pPCache )
{
Sequence<OUString> denylist { "com.sun.star.script.provider.ScriptProviderForBasic" };
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 765de8c155d0..4fb6c0ba230c 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -62,7 +62,7 @@ ProviderCache::~ProviderCache()
Reference< provider::XScriptProvider >
ProviderCache::getProvider( const OUString& providerName )
{
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
Reference< provider::XScriptProvider > provider;
ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.find( providerName );
if ( h_it != m_hProviderDetailsCache.end() )
@@ -86,7 +86,7 @@ ProviderCache::getAllProviders()
// need to create providers that haven't been created already
// so check what providers exist and what ones don't
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
Sequence < Reference< provider::XScriptProvider > > providers ( m_hProviderDetailsCache.size() );
// should assert if size !> 0
if ( !m_hProviderDetailsCache.empty() )
@@ -132,7 +132,7 @@ ProviderCache::populateCache()
{
// wrong name in services.rdb
OUString serviceName;
- std::lock_guard aGuard( m_mutex );
+ std::scoped_lock aGuard( m_mutex );
try
{
Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMgr, UNO_QUERY_THROW );
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
index 6e082d9019fa..c3fc1b207ece 100644
--- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
@@ -73,7 +73,7 @@ void ResourceFactoryManager::AddFactory (
if (rsURL.isEmpty())
throw lang::IllegalArgumentException();
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
if (rsURL.indexOf('*') >= 0 || rsURL.indexOf('?') >= 0)
{
@@ -100,7 +100,7 @@ void ResourceFactoryManager::RemoveFactoryForURL (
if (rsURL.isEmpty())
throw lang::IllegalArgumentException();
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
FactoryMap::iterator iFactory (maFactoryMap.find(rsURL));
if (iFactory != maFactoryMap.end())
@@ -123,7 +123,7 @@ void ResourceFactoryManager::RemoveFactoryForURL (
void ResourceFactoryManager::RemoveFactoryForReference(
const Reference<XResourceFactory>& rxFactory)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
// Collect a list with all keys that map to the given factory.
::std::vector<OUString> aKeys;
@@ -178,7 +178,7 @@ Reference<XResourceFactory> ResourceFactoryManager::GetFactory (
Reference<XResourceFactory> ResourceFactoryManager::FindFactory (const OUString& rsURLBase)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
FactoryMap::const_iterator iFactory (maFactoryMap.find(rsURLBase));
if (iFactory != maFactoryMap.end())
return iFactory->second;
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
index d515d21cf580..4b060879ae24 100644
--- a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
@@ -145,7 +145,7 @@ void QueueProcessor::ProcessOneRequest (
{
try
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
// Create a new preview bitmap and store it in the cache.
if (mpCache != nullptr && mpCacheContext)
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index 9130621ff762..1e020bc027a2 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -167,7 +167,7 @@ PPPOptimizerTokenEnum TKGet( const OUString& rToken )
{
if ( !pHashMap )
{ // init hash map
- std::lock_guard aGuard( getHashMapMutex() );
+ std::scoped_lock aGuard( getHashMapMutex() );
if ( !pHashMap )
{
TypeNameHashMap* pH = new TypeNameHashMap;
diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx
index f46fcd288ee0..67281e368b18 100644
--- a/sdext/source/presenter/PresenterTimer.cxx
+++ b/sdext/source/presenter/PresenterTimer.cxx
@@ -184,7 +184,7 @@ sal_Int32 TimerScheduler::mnTaskId = PresenterTimer::NotAValidTaskId;
std::shared_ptr<TimerScheduler> TimerScheduler::Instance(
uno::Reference<uno::XComponentContext> const& xContext)
{
- std::lock_guard aGuard (maInstanceMutex);
+ std::scoped_lock aGuard (maInstanceMutex);
if (mpInstance == nullptr)
{
if (!xContext.is())
@@ -226,7 +226,7 @@ void TimerScheduler::ScheduleTask (const SharedTimerTask& rpTask)
return;
{
- std::lock_guard aTaskGuard (maTaskContainerMutex);
+ std::scoped_lock aTaskGuard (maTaskContainerMutex);
maScheduledTasks.insert(rpTask);
}
}
@@ -237,7 +237,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
// task ids. Therefore we have to do a linear search for the task to
// cancel.
{
- std::lock_guard aGuard (maTaskContainerMutex);
+ std::scoped_lock aGuard (maTaskContainerMutex);
auto iTask = std::find_if(maScheduledTasks.begin(), maScheduledTasks.end(),
[nTaskId](const SharedTimerTask& rxTask) { return rxTask->mnTaskId == nTaskId; });
if (iTask != maScheduledTasks.end())
@@ -248,7 +248,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
// processed. Mark it with a flag that a) prevents a repeating task
// from being scheduled again and b) tries to prevent its execution.
{
- std::lock_guard aGuard (maCurrentTaskMutex);
+ std::scoped_lock aGuard (maCurrentTaskMutex);
if (mpCurrentTask
&& mpCurrentTask->mnTaskId == nTaskId)
mpCurrentTask->mbIsCanceled = true;
@@ -266,12 +266,12 @@ void TimerScheduler::NotifyTermination()
}
{
- std::lock_guard aGuard(pInstance->maTaskContainerMutex);
+ std::scoped_lock aGuard(pInstance->maTaskContainerMutex);
pInstance->maScheduledTasks.clear();
}
{
- std::lock_guard aGuard(pInstance->maCurrentTaskMutex);
+ std::scoped_lock aGuard(pInstance->maCurrentTaskMutex);
if (pInstance->mpCurrentTask)
{
pInstance->mpCurrentTask->mbIsCanceled = true;
@@ -303,7 +303,7 @@ void SAL_CALL TimerScheduler::run()
SharedTimerTask pTask;
sal_Int64 nDifference = 0;
{
- std::lock_guard aGuard (maTaskContainerMutex);
+ std::scoped_lock aGuard (maTaskContainerMutex);
// There are no more scheduled task. Leave this loop, function and
// live of the TimerScheduler.
@@ -322,7 +322,7 @@ void SAL_CALL TimerScheduler::run()
// Acquire a reference to the current task.
{
- std::lock_guard aGuard (maCurrentTaskMutex);
+ std::scoped_lock aGuard (maCurrentTaskMutex);
mpCurrentTask = pTask;
}
@@ -356,13 +356,13 @@ void SAL_CALL TimerScheduler::run()
// Release reference to the current task.
{
- std::lock_guard aGuard (maCurrentTaskMutex);
+ std::scoped_lock aGuard (maCurrentTaskMutex);
mpCurrentTask.reset();
}
}
// While holding maInstanceMutex
- std::lock_guard aInstance( maInstanceMutex );
+ std::scoped_lock aInstance( maInstanceMutex );
mpLateDestroy = mpInstance;
mpInstance.reset();
}
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index 36c321bf3b24..453f67a8d5b4 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -517,7 +517,7 @@ ThumbnailViewItemAcc::~ThumbnailViewItemAcc()
void ThumbnailViewItemAcc::ParentDestroyed()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
mpParent = nullptr;
}
@@ -731,7 +731,7 @@ lang::Locale SAL_CALL ThumbnailViewItemAcc::getLocale()
void SAL_CALL ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( !rxListener.is() )
return;
@@ -753,7 +753,7 @@ void SAL_CALL ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Refer
void SAL_CALL ThumbnailViewItemAcc::removeAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if( rxListener.is() )
{
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index f4fdb55037db..a35ce5269782 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -2670,7 +2670,7 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
{
if ( !mxOfficeInstDirs.is() )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
if ( !mxOfficeInstDirs.is() )
{
OSL_ENSURE( mxContext.is(), "No service manager!" );
diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx
index 0e888db85567..73bf2a398e73 100644
--- a/slideshow/source/engine/eventqueue.cxx
+++ b/slideshow/source/engine/eventqueue.cxx
@@ -77,7 +77,7 @@ namespace slideshow::internal
bool EventQueue::addEvent( const EventSharedPtr& rEvent )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
<< "\" [" << rEvent.get()
@@ -103,7 +103,7 @@ namespace slideshow::internal
bool EventQueue::addEventForNextRound( EventSharedPtr const& rEvent )
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
<< "\" [" << rEvent.get()
@@ -120,7 +120,7 @@ namespace slideshow::internal
bool EventQueue::addEventWhenQueueIsEmpty (const EventSharedPtr& rpEvent)
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
SAL_INFO("slideshow.eventqueue", "adding event \"" << rpEvent->GetDescription()
<< "\" [" << rpEvent.get()
@@ -140,14 +140,14 @@ namespace slideshow::internal
void EventQueue::forceEmpty()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
process_(true);
}
void EventQueue::process()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
process_(false);
}
@@ -257,14 +257,14 @@ namespace slideshow::internal
bool EventQueue::isEmpty() const
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
return maEvents.empty() && maNextEvents.empty() && maNextNextEvents.empty();
}
double EventQueue::nextTimeout() const
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
// return time for next entry (if any)
double nTimeout (::std::numeric_limits<double>::max());
@@ -281,7 +281,7 @@ namespace slideshow::internal
void EventQueue::clear()
{
- std::lock_guard aGuard( maMutex );
+ std::scoped_lock aGuard( maMutex );
// TODO(P1): Maybe a plain vector and vector.swap will
// be faster here. Profile.
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index cf75b1cf63cf..09b435550feb 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -146,7 +146,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
if (nBytesToRead < 0)
throw BufferSizeExceededException(OUString(),static_cast<XWeak*>(this));
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
@@ -190,7 +190,7 @@ void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 nBytesToSkip)
if ( m_aURL.isEmpty() )
return;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkError();
m_pSvStream->SeekRel(nBytesToSkip);
@@ -203,7 +203,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::available()
if ( m_aURL.isEmpty() )
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_Int64 nAvailable = m_pSvStream->remainingSize();
@@ -218,7 +218,7 @@ void SAL_CALL FileStreamWrapper_Impl::closeInput()
if ( m_aURL.isEmpty() )
return;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
m_pSvStream.reset();
#if OSL_DEBUG_LEVEL > 0
@@ -234,7 +234,7 @@ void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation )
if ( m_aURL.isEmpty() )
return;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
m_pSvStream->Seek(static_cast<sal_uInt32>(_nLocation));
@@ -247,7 +247,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( )
if ( m_aURL.isEmpty() )
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_uInt32 nPos = m_pSvStream->Tell();
@@ -261,7 +261,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( )
if ( m_aURL.isEmpty() )
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
checkError();
diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx
index c004d605485a..d5eebe804f46 100644
--- a/stoc/source/corereflection/lrucache.hxx
+++ b/stoc/source/corereflection/lrucache.hxx
@@ -126,7 +126,7 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::toFront( CacheEntry * pEntry )
template< class t_Key, class t_Val, class t_KeyHash >
inline t_Val LRU_Cache< t_Key, t_Val, t_KeyHash >::getValue( const t_Key & rKey ) const
{
- std::lock_guard aGuard( _aCacheMutex );
+ std::scoped_lock aGuard( _aCacheMutex );
const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) );
if (iFind != _aKey2Element.end())
{
@@ -146,7 +146,7 @@ template< class t_Key, class t_Val, class t_KeyHash >
inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::setValue(
const t_Key & rKey, const t_Val & rValue )
{
- std::lock_guard aGuard( _aCacheMutex );
+ std::scoped_lock aGuard( _aCacheMutex );
if (_nCachedElements > 0)
{
const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) );
@@ -184,7 +184,7 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::setValue(
template< class t_Key, class t_Val, class t_KeyHash >
inline void LRU_Cache< t_Key, t_Val, t_KeyHash >::clear()
{
- std::lock_guard aGuard( _aCacheMutex );
+ std::scoped_lock aGuard( _aCacheMutex );
_aKey2Element.clear();
for ( sal_Int32 nPos = _nCachedElements; nPos--; )
{
diff --git a/stoc/source/javavm/interact.cxx b/stoc/source/javavm/interact.cxx
index 45fba8aab597..4836a0710c2d 100644
--- a/stoc/source/javavm/interact.cxx
+++ b/stoc/source/javavm/interact.cxx
@@ -68,13 +68,13 @@ private:
void SAL_CALL InteractionRequest::RetryContinuation::select()
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_bSelected = true;
}
bool InteractionRequest::RetryContinuation::isSelected() const
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
return m_bSelected;
}
diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx
index efc33e5adf77..b600ab9c6794 100644
--- a/stoc/source/namingservice/namingservice.cxx
+++ b/stoc/source/namingservice/namingservice.cxx
@@ -89,7 +89,7 @@ Sequence< OUString > NamingService_Impl::getSupportedServiceNames()
// XServiceInfo
Reference< XInterface > NamingService_Impl::getRegisteredObject( const OUString& Name )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
Reference< XInterface > xRet;
HashMap_OWString_Interface::iterator aIt = aMap.find( Name );
if( aIt != aMap.end() )
@@ -100,14 +100,14 @@ Reference< XInterface > NamingService_Impl::getRegisteredObject( const OUString&
// XServiceInfo
void NamingService_Impl::registerObject( const OUString& Name, const Reference< XInterface >& Object )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
aMap[ Name ] = Object;
}
// XServiceInfo
void NamingService_Impl::revokeObject( const OUString& Name )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
aMap.erase( Name );
}
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index ad7cef754c60..d63a45abbfee 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -146,14 +146,14 @@ private:
// XEnumeration
sal_Bool ServiceEnumeration_Impl::hasMoreElements()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return nIt != aFactories.getLength();
}
// XEnumeration
Any ServiceEnumeration_Impl::nextElement()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
if( nIt == aFactories.getLength() )
throw NoSuchElementException("no more elements");
@@ -224,14 +224,14 @@ private:
// XEnumeration
sal_Bool ImplementationEnumeration_Impl::hasMoreElements()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return aIt != aImplementationMap.end();
}
// XEnumeration
Any ImplementationEnumeration_Impl::nextElement()
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
if( aIt == aImplementationMap.end() )
throw NoSuchElementException("no more elements");
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 7b7b9d8d132d..6175de241400 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -179,18 +179,18 @@ private:
};
OUString Key::getKeyName() {
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
return key_.getName();
}
sal_Bool Key::isReadOnly()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
return key_.isReadOnly();
}
sal_Bool Key::isValid() {
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
return key_.isValid();
}
@@ -201,7 +201,7 @@ css::registry::RegistryKeyType Key::getKeyType(OUString const & )
css::registry::RegistryValueType Key::getValueType()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -242,7 +242,7 @@ css::registry::RegistryValueType Key::getValueType()
sal_Int32 Key::getLongValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
sal_Int32 value;
RegError err = key_.getValue(OUString(), &value);
switch (err) {
@@ -264,7 +264,7 @@ sal_Int32 Key::getLongValue()
void Key::setLongValue(sal_Int32 value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RegValueType::LONG, &value, sizeof (sal_Int32));
if (err != RegError::NO_ERROR) {
@@ -277,7 +277,7 @@ void Key::setLongValue(sal_Int32 value)
css::uno::Sequence< sal_Int32 > Key::getLongListValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryValueList< sal_Int32 > list;
RegError err = key_.getLongListValue(OUString(), list);
switch (err) {
@@ -313,7 +313,7 @@ css::uno::Sequence< sal_Int32 > Key::getLongListValue()
void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
auto list = comphelper::sequenceToContainer<std::vector<sal_Int32>>(seqValue);
RegError err = key_.setLongListValue(
OUString(), list.data(), static_cast< sal_uInt32 >(list.size()));
@@ -327,7 +327,7 @@ void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
OUString Key::getAsciiValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -390,7 +390,7 @@ OUString Key::getAsciiValue()
void Key::setAsciiValue(OUString const & value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
OString utf8;
if (!value.convertToString(
&utf8, RTL_TEXTENCODING_UTF8,
@@ -416,7 +416,7 @@ void Key::setAsciiValue(OUString const & value)
css::uno::Sequence< OUString > Key::getAsciiListValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryValueList< char * > list;
RegError err = key_.getStringListValue(OUString(), list);
switch (err) {
@@ -469,7 +469,7 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
void Key::setAsciiListValue(
css::uno::Sequence< OUString > const & seqValue)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
std::vector< OString > list;
for (const auto& rValue : seqValue) {
OString utf8;
@@ -503,7 +503,7 @@ void Key::setAsciiListValue(
OUString Key::getStringValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -554,7 +554,7 @@ OUString Key::getStringValue()
void Key::setStringValue(OUString const & value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RegValueType::UNICODE,
const_cast< sal_Unicode * >(value.getStr()),
@@ -570,7 +570,7 @@ void Key::setStringValue(OUString const & value)
css::uno::Sequence< OUString > Key::getStringListValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryValueList< sal_Unicode * > list;
RegError err = key_.getUnicodeListValue(OUString(), list);
switch (err) {
@@ -609,7 +609,7 @@ css::uno::Sequence< OUString > Key::getStringListValue()
void Key::setStringListValue(
css::uno::Sequence< OUString > const & seqValue)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
std::vector< sal_Unicode * > list;
list.reserve(seqValue.getLength());
std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(list),
@@ -627,7 +627,7 @@ void Key::setStringListValue(
css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
RegError err = key_.getValueInfo(OUString(), &type, &size);
@@ -662,7 +662,7 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RegValueType::BINARY,
const_cast< sal_Int8 * >(value.getConstArray()),
@@ -678,7 +678,7 @@ void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
OUString const & aKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKey key;
RegError err = key_.openKey(aKeyName, key);
switch (err) {
@@ -697,7 +697,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
OUString const & aKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKey key;
RegError err = key_.createKey(aKeyName, key);
switch (err) {
@@ -715,7 +715,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
void Key::closeKey()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.closeKey();
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -727,7 +727,7 @@ void Key::closeKey()
void Key::deleteKey(OUString const & rKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegError err = key_.deleteKey(rKeyName);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -740,7 +740,7 @@ void Key::deleteKey(OUString const & rKeyName)
css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
Key::openKeys()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKeyArray list;
RegError err = key_.openSubKeys(OUString(), list);
if (err != RegError::NO_ERROR) {
@@ -767,7 +767,7 @@ Key::openKeys()
css::uno::Sequence< OUString > Key::getKeyNames()
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
RegistryKeyNames list;
RegError err = key_.getKeyNames(OUString(), list);
if (err != RegError::NO_ERROR) {
@@ -814,7 +814,7 @@ OUString Key::getLinkTarget(OUString const & /*rLinkName*/)
OUString Key::getResolvedName(OUString const & aKeyName)
{
- std::lock_guard guard(registry_->mutex_);
+ std::scoped_lock guard(registry_->mutex_);
OUString resolved;
RegError err = key_.getResolvedKeyName(aKeyName, resolved);
if (err != RegError::NO_ERROR) {
@@ -827,14 +827,14 @@ OUString Key::getResolvedName(OUString const & aKeyName)
}
OUString SimpleRegistry::getURL() {
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
return registry_.getName();
}
void SimpleRegistry::open(
OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegError err = (rURL.isEmpty() && bCreate)
? RegError::REGISTRY_NOT_EXISTS
: registry_.open(rURL, bReadOnly ? RegAccessMode::READONLY : RegAccessMode::READWRITE);
@@ -850,13 +850,13 @@ void SimpleRegistry::open(
}
sal_Bool SimpleRegistry::isValid() {
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
return registry_.isValid();
}
void SimpleRegistry::close()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegError err = registry_.close();
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -868,7 +868,7 @@ void SimpleRegistry::close()
void SimpleRegistry::destroy()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegError err = registry_.destroy(OUString());
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -880,7 +880,7 @@ void SimpleRegistry::destroy()
css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegistryKey root;
RegError err = registry_.openRootKey(root);
if (err != RegError::NO_ERROR) {
@@ -894,14 +894,14 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
sal_Bool SimpleRegistry::isReadOnly()
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
return registry_.isReadOnly();
}
void SimpleRegistry::mergeKey(
OUString const & aKeyName, OUString const & aUrl)
{
- std::lock_guard guard(mutex_);
+ std::scoped_lock guard(mutex_);
RegistryKey root;
RegError err = registry_.openRootKey(root);
if (err == RegError::NO_ERROR) {
diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx
index 4bcbe13c5c7c..7ad7f4c62ba1 100644
--- a/svl/source/config/itemholder2.cxx
+++ b/svl/source/config/itemholder2.cxx
@@ -75,7 +75,7 @@ void SAL_CALL ItemHolder2::disposing(const css::lang::EventObject&)
void ItemHolder2::impl_addItem(EItem eItem)
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
for ( auto const & rInfo : m_lItems )
{
@@ -94,7 +94,7 @@ void ItemHolder2::impl_releaseAllItems()
{
std::vector< TItemInfo > items;
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
items.swap(m_lItems);
}
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx
index bcb53c294128..2fe8fd8a13ff 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -77,7 +77,7 @@ SharedStringPool::~SharedStringPool() {}
SharedString SharedStringPool::intern(const OUString& rStr)
{
StringWithHash aStrWithHash(rStr);
- std::lock_guard<std::mutex> aGuard(mpImpl->maMutex);
+ std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex);
auto[mapIt, bInserted] = mpImpl->maStrMap.emplace(aStrWithHash, rStr);
if (!bInserted)
@@ -112,7 +112,7 @@ SharedString SharedStringPool::intern(const OUString& rStr)
void SharedStringPool::purge()
{
- std::lock_guard<std::mutex> aGuard(mpImpl->maMutex);
+ std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex);
// Because we can have an uppercase entry mapped to itself,
// and then a bunch of lowercase entries mapped to that same
@@ -163,13 +163,13 @@ void SharedStringPool::purge()
size_t SharedStringPool::getCount() const
{
- std::lock_guard<std::mutex> aGuard(mpImpl->maMutex);
+ std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex);
return mpImpl->maStrMap.size();
}
size_t SharedStringPool::getCountIgnoreCase() const
{
- std::lock_guard<std::mutex> aGuard(mpImpl->maMutex);
+ std::scoped_lock<std::mutex> aGuard(mpImpl->maMutex);
// this is only called from unit tests, so no need to be efficient
std::unordered_set<OUString> aUpperSet;
for (auto const& pair : mpImpl->maStrMap)
diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx
index 396a90322a65..bc588f9dfe1c 100644
--- a/svtools/source/config/itemholder2.cxx
+++ b/svtools/source/config/itemholder2.cxx
@@ -86,7 +86,7 @@ void SAL_CALL ItemHolder2::disposing(const css::lang::EventObject&)
void ItemHolder2::impl_addItem(EItem eItem)
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
for ( auto const & rInfo : m_lItems )
{
@@ -106,7 +106,7 @@ void ItemHolder2::impl_releaseAllItems()
{
std::vector<TItemInfo> items;
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
items.swap(m_lItems);
}
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 43a1d68544f5..7f8a591567b3 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -127,7 +127,7 @@ static bool gbAllowAA = false;
bool IsAAPossibleOnThisSystem()
{
- std::lock_guard aGuard(gaAntiAliasMutex);
+ std::scoped_lock aGuard(gaAntiAliasMutex);
if (!gbAllowAAInit)
{
gbAllowAAInit = true;
@@ -141,7 +141,7 @@ bool IsAntiAliasing()
{
bool bAntiAliasing;
{
- std::lock_guard aGuard(gaAntiAliasMutex);
+ std::scoped_lock aGuard(gaAntiAliasMutex);
if (!gbAntiAliasingInit)
{
gbAntiAliasingInit = true;
@@ -159,7 +159,7 @@ bool IsAntiAliasing()
*/
void SetAntiAliasing( bool bOn, bool bTemporary )
{
- std::lock_guard aGuard(gaAntiAliasMutex);
+ std::scoped_lock aGuard(gaAntiAliasMutex);
if (!bTemporary)
{
std::shared_ptr<comphelper::ConfigurationChanges> batch =
diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx
index e4faadfffc25..1fb8b613eb09 100644
--- a/svtools/source/control/asynclink.cxx
+++ b/svtools/source/control/asynclink.cxx
@@ -37,7 +37,7 @@ void AsynchronLink::Call( void* pObj, bool bAllowDoubles )
_pArg = pObj;
DBG_ASSERT( bAllowDoubles || !_nEventId, "Already made a call" );
ClearPendingCall();
- std::lock_guard aGuard(_aMutex);
+ std::scoped_lock aGuard(_aMutex);
_nEventId = Application::PostUserEvent( LINK( this, AsynchronLink, HandleCall_PostUserEvent) );
}
@@ -53,7 +53,7 @@ AsynchronLink::~AsynchronLink()
void AsynchronLink::ClearPendingCall()
{
- std::lock_guard aGuard(_aMutex);
+ std::scoped_lock aGuard(_aMutex);
if( _nEventId )
{
Application::RemoveUserEvent( _nEventId );
@@ -64,7 +64,7 @@ void AsynchronLink::ClearPendingCall()
IMPL_LINK_NOARG( AsynchronLink, HandleCall_PostUserEvent, void*, void )
{
{
- std::lock_guard aGuard(_aMutex);
+ std::scoped_lock aGuard(_aMutex);
_nEventId = nullptr;
// need to release the lock before calling the client since
// the client may call back into us
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 61940085eff1..6fee437ead94 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -155,7 +155,7 @@ void SvtMatchContext_Impl::Stop()
css::uno::Reference< css::ucb::XCommandProcessor > proc;
sal_Int32 id(0);
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (!stopped_) {
stopped_ = true;
proc = processor_;
@@ -185,7 +185,7 @@ IMPL_LINK_NOARG( SvtMatchContext_Impl, Select_Impl, void*, void )
{
// avoid recursion through cancel button
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (stopped_) {
// Completion was stopped, no display:
return;
@@ -403,7 +403,7 @@ void SvtMatchContext_Impl::doExecute()
::osl::MutexGuard aGuard( theSvtMatchContextMutex::get() );
{
// have we been stopped while we were waiting for the mutex?
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
if (stopped_) {
return;
}
@@ -478,7 +478,7 @@ void SvtMatchContext_Impl::doExecute()
sal_Int32 id = proc->createCommandIdentifier();
try {
{
- std::lock_guard g(mutex_);
+ std::scoped_lock g(mutex_);
processor_ = proc;
commandId_ = id;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list