UnoControls/source/controls/progressmonitor.cxx               |   20 
 accessibility/source/extended/AccessibleBrowseBoxBase.cxx     |    2 
 accessibility/source/extended/textwindowaccessibility.cxx     |    4 
 chart2/source/controller/accessibility/AccessibleBase.cxx     |   39 
 chart2/source/view/main/ChartView.cxx                         |    4 
 comphelper/source/container/enumhelper.cxx                    |   24 
 comphelper/source/misc/instancelocker.cxx                     |   14 
 comphelper/source/misc/numberedcollection.cxx                 |   14 
 comphelper/source/property/genericpropertyset.cxx             |    2 
 comphelper/source/property/opropertybag.cxx                   |   63 -
 dbaccess/source/core/api/statement.cxx                        |    2 
 dbaccess/source/core/dataaccess/databasedocument.cxx          |   74 -
 dbaccess/source/core/dataaccess/definitioncontainer.cxx       |    2 
 dbaccess/source/core/dataaccess/documentcontainer.cxx         |    6 
 dbaccess/source/core/dataaccess/documentdefinition.cxx        |    4 
 dbaccess/source/ui/misc/dbaundomanager.cxx                    |    2 
 desktop/source/app/dispatchwatcher.cxx                        |    9 
 desktop/source/deployment/gui/dp_gui_extlistbox.cxx           |  118 +-
 desktop/source/offacc/acceptor.cxx                            |    2 
 desktop/source/splash/splash.cxx                              |    2 
 dtrans/source/win32/clipb/MtaOleClipb.cxx                     |    4 
 dtrans/source/win32/clipb/WinClipbImpl.cxx                    |   41 
 embeddedobj/source/commonembedding/embedobj.cxx               |    2 
 embeddedobj/source/msole/olecomponent.cxx                     |   72 -
 embeddedobj/source/msole/olepersist.cxx                       |    6 
 extensions/source/update/check/updatecheck.cxx                |    9 
 filter/source/config/cache/basecontainer.cxx                  |   32 
 filter/source/config/cache/cacheupdatelistener.cxx            |    9 
 filter/source/config/cache/contenthandlerfactory.cxx          |    2 
 filter/source/config/cache/filtercache.cxx                    |   58 -
 filter/source/config/cache/filterfactory.cxx                  |   21 
 filter/source/config/cache/frameloaderfactory.cxx             |    2 
 filter/source/config/cache/typedetection.cxx                  |   35 
 forms/source/component/DatabaseForm.cxx                       |   16 
 forms/source/component/FormComponent.cxx                      |    6 
 forms/source/component/ListBox.cxx                            |    2 
 fpicker/source/win32/VistaFilePickerImpl.cxx                  |   36 
 fpicker/source/win32/asyncrequests.cxx                        |   30 
 framework/source/accelerators/storageholder.cxx               |   39 
 framework/source/dispatch/interceptionhelper.cxx              |   52 
 framework/source/fwe/helper/titlehelper.cxx                   |   38 
 framework/source/fwi/threadhelp/transactionmanager.cxx        |   28 
 framework/source/helper/statusindicatorfactory.cxx            |    9 
 framework/source/jobs/job.cxx                                 |   34 
 framework/source/layoutmanager/layoutmanager.cxx              |  250 ++--
 framework/source/layoutmanager/toolbarlayoutmanager.cxx       |  327 +++---
 framework/source/loadenv/loadenv.cxx                          |   71 -
 framework/source/services/autorecovery.cxx                    |    2 
 framework/source/services/desktop.cxx                         |   18 
 framework/source/services/dispatchhelper.cxx                  |    9 
 framework/source/services/frame.cxx                           |   80 -
 framework/source/tabwin/tabwindow.cxx                         |   36 
 framework/source/uiconfiguration/windowstateconfiguration.cxx |    6 
 framework/source/uielement/controlmenucontroller.cxx          |   10 
 framework/source/uielement/newmenucontroller.cxx              |    9 
 framework/source/uielement/recentfilesmenucontroller.cxx      |    7 
 framework/source/uielement/toolbarmodemenucontroller.cxx      |   11 
 framework/source/uielement/toolbarsmenucontroller.cxx         |   15 
 include/comphelper/componentbase.hxx                          |    2 
 package/source/xstor/ohierarchyholder.cxx                     |   14 
 package/source/xstor/owriteablestream.cxx                     |   84 -
 package/source/xstor/owriteablestream.hxx                     |    2 
 package/source/xstor/xstorage.cxx                             |  536 +++++-----
 reportdesign/source/core/api/ReportDefinition.cxx             |    8 
 reportdesign/source/ui/inspection/DataProviderHandler.cxx     |    2 
 reportdesign/source/ui/report/ReportControllerObserver.cxx    |    2 
 sax/source/fastparser/fastparser.cxx                          |    2 
 sd/source/core/stlsheet.cxx                                   |   11 
 sd/source/ui/dlg/RemoteDialogClientBox.cxx                    |   30 
 sfx2/source/appl/preventduplicateinteraction.cxx              |   25 
 sfx2/source/appl/shutdownicon.cxx                             |    6 
 sfx2/source/doc/SfxDocumentMetaData.cxx                       |   38 
 sfx2/source/doc/doctemplates.cxx                              |    9 
 sfx2/source/inc/docundomanager.hxx                            |    2 
 sfx2/source/notify/globalevents.cxx                           |   45 
 svl/source/config/itemholder2.cxx                             |    2 
 svtools/source/config/itemholder2.cxx                         |    4 
 svtools/source/misc/acceleratorexecute.cxx                    |    4 
 svtools/source/uno/popupmenucontrollerbase.cxx                |   14 
 svx/source/accessibility/AccessibleTextHelper.cxx             |   26 
 toolkit/source/controls/unocontrols.cxx                       |    4 
 ucb/source/ucp/webdav-neon/NeonLockStore.cxx                  |    7 
 unotools/source/config/itemholder1.cxx                        |    2 
 vcl/source/components/dtranscomp.cxx                          |    4 
 84 files changed, 1378 insertions(+), 1348 deletions(-)

New commits:
commit 5a824268dfdd48c00f656b767b48cd12ccbdaabb
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Apr 7 11:48:47 2019 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Apr 7 17:53:04 2019 +0200

    Don't use resettable/clearable guard where plain guard is enough
    
    Also use scope where possible. This allows to limit guard scope at
    language level; visualises the scope clearly; and helps avoiding
    errors like fixed in commit 61e4437c857854b331fa01da6f39b2b3b58a800b.
    
    Change-Id: Ifeca96e2df8e8a0897770d9546b2536806275f41
    Reviewed-on: https://gerrit.libreoffice.org/70376
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/UnoControls/source/controls/progressmonitor.cxx 
b/UnoControls/source/controls/progressmonitor.cxx
index 7e439beb5e60..23451ac5c2a9 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -799,19 +799,19 @@ IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( 
const OUString& rTopic, b
     ::std::vector< std::unique_ptr<IMPL_TextlistItem> >* pTextList;
 
     // Ready for multithreading
-    ClearableMutexGuard aGuard ( m_aMutex );
-
-    if ( bbeforeProgress )
     {
-        pTextList = &maTextlist_Top;
-    }
-    else
-    {
-        pTextList = &maTextlist_Bottom;
-    }
+        MutexGuard aGuard(m_aMutex);
 
+        if (bbeforeProgress)
+        {
+            pTextList = &maTextlist_Top;
+        }
+        else
+        {
+            pTextList = &maTextlist_Bottom;
+        }
+    }
     // Switch off guard.
-    aGuard.clear ();
 
     // Search the topic in textlist.
     size_t nPosition    = 0;
diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx 
b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
index 488d42f7c68c..f8d733c3e30b 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
@@ -414,7 +414,7 @@ tools::Rectangle 
AccessibleBrowseBoxBase::getBoundingBoxOnScreen()
 void AccessibleBrowseBoxBase::commitEvent(
         sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
 {
-    ::osl::ClearableMutexGuard aGuard( getMutex() );
+    osl::MutexGuard aGuard( getMutex() );
     if ( !getClientId( ) )
             // if we don't have a client id for the notifier, then we don't 
have listeners, then
             // we don't need to notify anything
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx 
b/accessibility/source/extended/textwindowaccessibility.cxx
index 927895339a7e..3cebc2ba295e 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -589,7 +589,7 @@ void SAL_CALL Paragraph::removeAccessibleEventListener(
 {
     comphelper::AccessibleEventNotifier::TClientId nId = 0;
     {
-        ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
+        osl::MutexGuard aGuard(rBHelper.rMutex);
         if (rListener.is() && m_nClientId != 0
             && comphelper::AccessibleEventNotifier::removeEventListener( 
m_nClientId, rListener ) == 0)
         {
@@ -612,7 +612,7 @@ void SAL_CALL Paragraph::disposing()
 {
     comphelper::AccessibleEventNotifier::TClientId nId = 0;
     {
-        ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
+        osl::MutexGuard aGuard(rBHelper.rMutex);
         nId = m_nClientId;
         m_nClientId = 0;
     }
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx 
b/chart2/source/controller/accessibility/AccessibleBase.cxx
index ce2c5769c812..281c86ca203d 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -56,7 +56,6 @@ using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::Reference;
 using ::osl::MutexGuard;
 using ::osl::ClearableMutexGuard;
-using ::osl::ResettableMutexGuard;
 using ::com::sun::star::uno::Any;
 
 namespace chart
@@ -412,29 +411,31 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo 
& rNewInfo )
 // ________ (XComponent::dispose) ________
 void SAL_CALL AccessibleBase::disposing()
 {
-    ClearableMutexGuard aGuard( GetMutex() );
-    OSL_ENSURE( ! m_bIsDisposed, "dispose() called twice" );
-
-    // notify disposing to all AccessibleEvent listeners asynchron
-    if ( m_nEventNotifierId )
     {
-        ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( 
m_nEventNotifierId, *this );
-        m_nEventNotifierId = 0;
-    }
+        MutexGuard aGuard(GetMutex());
+        OSL_ENSURE(!m_bIsDisposed, "dispose() called twice");
+
+        // notify disposing to all AccessibleEvent listeners asynchron
+        if (m_nEventNotifierId)
+        {
+            
::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(m_nEventNotifierId,
+                                                                               
*this);
+            m_nEventNotifierId = 0;
+        }
 
-    // reset pointers
-    m_aAccInfo.m_pParent = nullptr;
+        // reset pointers
+        m_aAccInfo.m_pParent = nullptr;
 
-    // attach new empty state set helper to member reference
-    ::utl::AccessibleStateSetHelper * pHelper = new 
::utl::AccessibleStateSetHelper();
-    pHelper->AddState( AccessibleStateType::DEFUNC );
-    // release old helper and attach new one
-    m_xStateSetHelper = pHelper;
+        // attach new empty state set helper to member reference
+        ::utl::AccessibleStateSetHelper * pHelper = new 
::utl::AccessibleStateSetHelper();
+        pHelper->AddState(AccessibleStateType::DEFUNC);
+        // release old helper and attach new one
+        m_xStateSetHelper = pHelper;
 
-    m_bIsDisposed = true;
+        m_bIsDisposed = true;
 
+    }
     // call listeners unguarded
-    aGuard.clear();
 
     if( m_bMayHaveChildren )
     {
@@ -480,7 +481,7 @@ Reference< XAccessible > SAL_CALL 
AccessibleBase::getAccessibleChild( sal_Int32
     CheckDisposeState();
     Reference< XAccessible > xResult;
 
-    ResettableMutexGuard aGuard( GetMutex() );
+    ClearableMutexGuard aGuard( GetMutex() );
     bool bMustUpdateChildren = ( m_bMayHaveChildren &&
                                  ! m_bChildrenInitialized );
 
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index b2e493e8d46e..872406f9f16b 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2453,7 +2453,7 @@ void ChartView::createShapes()
 {
     SolarMutexGuard aSolarGuard;
 
-    osl::ResettableMutexGuard aTimedGuard(maTimeMutex);
+    osl::MutexGuard aTimedGuard(maTimeMutex);
     if(mrChartModel.isTimeBased())
     {
         maTimeBased.bTimeBased = true;
@@ -2927,7 +2927,7 @@ OUString ChartView::dump()
 
 void ChartView::setViewDirty()
 {
-    osl::ResettableMutexGuard aGuard(maTimeMutex);
+    osl::MutexGuard aGuard(maTimeMutex);
     m_bViewDirty = true;
 }
 
diff --git a/comphelper/source/container/enumhelper.cxx 
b/comphelper/source/container/enumhelper.cxx
index b62838d3b39c..41585ae24a8a 100644
--- a/comphelper/source/container/enumhelper.cxx
+++ b/comphelper/source/container/enumhelper.cxx
@@ -53,7 +53,7 @@ OEnumerationByName::~OEnumerationByName()
 
 sal_Bool SAL_CALL OEnumerationByName::hasMoreElements(  )
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (m_xAccess.is() && m_aNames.getLength() > m_nPos)
         return true;
@@ -70,7 +70,7 @@ sal_Bool SAL_CALL OEnumerationByName::hasMoreElements(  )
 
 css::uno::Any SAL_CALL OEnumerationByName::nextElement(  )
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     css::uno::Any aRes;
     if (m_xAccess.is() && m_nPos < m_aNames.getLength())
@@ -91,7 +91,7 @@ css::uno::Any SAL_CALL OEnumerationByName::nextElement(  )
 
 void SAL_CALL OEnumerationByName::disposing(const css::lang::EventObject& 
aEvent)
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (aEvent.Source == m_xAccess)
         m_xAccess.clear();
@@ -100,7 +100,7 @@ void SAL_CALL OEnumerationByName::disposing(const 
css::lang::EventObject& aEvent
 
 void OEnumerationByName::impl_startDisposeListening()
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (m_bListening)
         return;
@@ -118,7 +118,7 @@ void OEnumerationByName::impl_startDisposeListening()
 
 void OEnumerationByName::impl_stopDisposeListening()
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (!m_bListening)
         return;
@@ -150,7 +150,7 @@ OEnumerationByIndex::~OEnumerationByIndex()
 
 sal_Bool SAL_CALL OEnumerationByIndex::hasMoreElements(  )
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (m_xAccess.is() && m_xAccess->getCount() > m_nPos)
         return true;
@@ -167,7 +167,7 @@ sal_Bool SAL_CALL OEnumerationByIndex::hasMoreElements(  )
 
 css::uno::Any SAL_CALL OEnumerationByIndex::nextElement(  )
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     css::uno::Any aRes;
     if (m_xAccess.is() && m_nPos < m_xAccess->getCount())
@@ -187,7 +187,7 @@ css::uno::Any SAL_CALL OEnumerationByIndex::nextElement(  )
 
 void SAL_CALL OEnumerationByIndex::disposing(const css::lang::EventObject& 
aEvent)
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (aEvent.Source == m_xAccess)
         m_xAccess.clear();
@@ -196,7 +196,7 @@ void SAL_CALL OEnumerationByIndex::disposing(const 
css::lang::EventObject& aEven
 
 void OEnumerationByIndex::impl_startDisposeListening()
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (m_bListening)
         return;
@@ -214,7 +214,7 @@ void OEnumerationByIndex::impl_startDisposeListening()
 
 void OEnumerationByIndex::impl_stopDisposeListening()
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     if (!m_bListening)
         return;
@@ -243,7 +243,7 @@ OAnyEnumeration::~OAnyEnumeration()
 
 sal_Bool SAL_CALL OAnyEnumeration::hasMoreElements(  )
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     return (m_lItems.getLength() > m_nPos);
 }
@@ -254,7 +254,7 @@ css::uno::Any SAL_CALL OAnyEnumeration::nextElement(  )
     if ( ! hasMoreElements())
         throw css::container::NoSuchElementException();
 
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
     sal_Int32 nPos = m_nPos;
     ++m_nPos;
     return m_lItems[nPos];
diff --git a/comphelper/source/misc/instancelocker.cxx 
b/comphelper/source/misc/instancelocker.cxx
index 43991cec43b1..c995499d8410 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -211,7 +211,7 @@ OLockListener::~OLockListener()
 
 void OLockListener::Dispose()
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
 
     if ( m_bDisposed )
         return;
@@ -251,7 +251,7 @@ void OLockListener::Dispose()
 
 void SAL_CALL OLockListener::disposing( const lang::EventObject& aEvent )
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
 
     // object is disposed
     if ( aEvent.Source == m_xInstance )
@@ -276,7 +276,7 @@ void SAL_CALL OLockListener::disposing( const 
lang::EventObject& aEvent )
 void SAL_CALL OLockListener::queryClosing( const lang::EventObject& aEvent, 
sal_Bool )
 {
     // GetsOwnership parameter is always ignored, the user of the service must 
close the object always
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
     if ( !m_bDisposed && aEvent.Source == m_xInstance && ( m_nMode & 
embed::Actions::PREVENT_CLOSE ) )
     {
         try
@@ -304,7 +304,7 @@ void SAL_CALL OLockListener::queryClosing( const 
lang::EventObject& aEvent, sal_
 
 void SAL_CALL OLockListener::notifyClosing( const lang::EventObject& aEvent )
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
 
     // object is closed, no reason to listen
     if ( aEvent.Source == m_xInstance )
@@ -334,7 +334,7 @@ void SAL_CALL OLockListener::notifyClosing( const 
lang::EventObject& aEvent )
 
 void SAL_CALL OLockListener::queryTermination( const lang::EventObject& aEvent 
)
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
     if ( aEvent.Source == m_xInstance && ( m_nMode & 
embed::Actions::PREVENT_TERMINATION ) )
     {
         try
@@ -362,7 +362,7 @@ void SAL_CALL OLockListener::queryTermination( const 
lang::EventObject& aEvent )
 
 void SAL_CALL OLockListener::notifyTermination( const lang::EventObject& 
aEvent )
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
 
     // object is terminated, no reason to listen
     if ( aEvent.Source == m_xInstance )
@@ -397,7 +397,7 @@ void SAL_CALL OLockListener::notifyTermination( const 
lang::EventObject& aEvent
 
 void OLockListener::Init()
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
 
     if ( m_bDisposed || m_bInitialized )
         return;
diff --git a/comphelper/source/misc/numberedcollection.cxx 
b/comphelper/source/misc/numberedcollection.cxx
index 43aa31f972ec..81533aa7b249 100644
--- a/comphelper/source/misc/numberedcollection.cxx
+++ b/comphelper/source/misc/numberedcollection.cxx
@@ -44,7 +44,7 @@ NumberedCollection::~NumberedCollection()
 void NumberedCollection::setOwner(const css::uno::Reference< 
css::uno::XInterface >& xOwner)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     m_xOwner = xOwner;
 
@@ -55,7 +55,7 @@ void NumberedCollection::setOwner(const css::uno::Reference< 
css::uno::XInterfac
 void NumberedCollection::setUntitledPrefix(const OUString& sPrefix)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     m_sUntitledPrefix = sPrefix;
 
@@ -66,7 +66,7 @@ void NumberedCollection::setUntitledPrefix(const OUString& 
sPrefix)
 ::sal_Int32 SAL_CALL NumberedCollection::leaseNumber(const 
css::uno::Reference< css::uno::XInterface >& xComponent)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     if ( ! xComponent.is ())
         throw 
css::lang::IllegalArgumentException(ERRMSG_INVALID_COMPONENT_PARAM, 
m_xOwner.get(), 1);
@@ -101,7 +101,7 @@ void NumberedCollection::setUntitledPrefix(const OUString& 
sPrefix)
 void SAL_CALL NumberedCollection::releaseNumber(::sal_Int32 nNumber)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     if (nNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER)
         throw css::lang::IllegalArgumentException ("Special valkud 
INVALID_NUMBER not allowed as input parameter.", m_xOwner.get(), 1);
@@ -138,7 +138,7 @@ void SAL_CALL NumberedCollection::releaseNumber(::sal_Int32 
nNumber)
 void SAL_CALL NumberedCollection::releaseNumberForComponent(const 
css::uno::Reference< css::uno::XInterface >& xComponent)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     if ( ! xComponent.is ())
         throw 
css::lang::IllegalArgumentException(ERRMSG_INVALID_COMPONENT_PARAM, 
m_xOwner.get(), 1);
@@ -160,7 +160,7 @@ void SAL_CALL 
NumberedCollection::releaseNumberForComponent(const css::uno::Refe
 OUString SAL_CALL NumberedCollection::getUntitledPrefix()
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     return m_sUntitledPrefix;
 
@@ -195,8 +195,8 @@ OUString SAL_CALL NumberedCollection::getUntitledPrefix()
         lPossibleNumbers.push_back (i);
 
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
     {
+        osl::MutexGuard aLock(m_aMutex);
         TDeadItemList                     lDeadItems;
 
         for (const auto& [rComponent, rItem] : m_lComponents)
diff --git a/comphelper/source/property/genericpropertyset.cxx 
b/comphelper/source/property/genericpropertyset.cxx
index af224f822ede..5ce75e30323a 100644
--- a/comphelper/source/property/genericpropertyset.cxx
+++ b/comphelper/source/property/genericpropertyset.cxx
@@ -117,7 +117,7 @@ void SAL_CALL 
GenericPropertySet::addPropertyChangeListener( const OUString& aPr
 
 void SAL_CALL GenericPropertySet::removePropertyChangeListener( const 
OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
 {
-    ResettableMutexGuard aGuard( maMutex );
+    ClearableMutexGuard aGuard( maMutex );
     Reference < XPropertySetInfo > xInfo = getPropertySetInfo(  );
     aGuard.clear();
     if ( xInfo.is() )
diff --git a/comphelper/source/property/opropertybag.cxx 
b/comphelper/source/property/opropertybag.cxx
index 43dfc4cfdc71..fd5807fae03f 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -208,21 +208,21 @@ namespace comphelper
         if ( !( _element >>= aProperty ) )
             throw IllegalArgumentException( OUString(), *this, 1 );
 
-        ::osl::ClearableMutexGuard g( m_aMutex );
-
-        // check whether the type is allowed, everything else will be checked
-        // by m_aDynamicProperties
-        if  (   !m_aAllowedTypes.empty()
-            &&  m_aAllowedTypes.find( aProperty.Type ) == m_aAllowedTypes.end()
-            )
-            throw IllegalArgumentException( OUString(), *this, 1 );
+        {
+            osl::MutexGuard g(m_aMutex);
 
-        m_aDynamicProperties.addVoidProperty( aProperty.Name, aProperty.Type, 
findFreeHandle(), aProperty.Attributes );
+            // check whether the type is allowed, everything else will be 
checked
+            // by m_aDynamicProperties
+            if (!m_aAllowedTypes.empty()
+                && m_aAllowedTypes.find(aProperty.Type) == 
m_aAllowedTypes.end())
+                throw IllegalArgumentException(OUString(), *this, 1);
 
-        // our property info is dirty
-        m_pArrayHelper.reset();
+            m_aDynamicProperties.addVoidProperty(aProperty.Name, 
aProperty.Type, findFreeHandle(),
+                                                 aProperty.Attributes);
 
-        g.clear();
+            // our property info is dirty
+            m_pArrayHelper.reset();
+        }
         setModified(true);
     }
 
@@ -312,37 +312,36 @@ namespace comphelper
 
     void SAL_CALL OPropertyBag::addProperty( const OUString& _rName, 
::sal_Int16 _nAttributes, const Any& _rInitialValue )
     {
-        ::osl::ClearableMutexGuard g( m_aMutex );
-
-        // check whether the type is allowed, everything else will be checked
-        // by m_aDynamicProperties
-        const Type& aPropertyType = _rInitialValue.getValueType();
-        if  (   _rInitialValue.hasValue()
-            &&  !m_aAllowedTypes.empty()
-            &&  m_aAllowedTypes.find( aPropertyType ) == m_aAllowedTypes.end()
-            )
-            throw IllegalTypeException( OUString(), *this );
+        {
+            osl::MutexGuard g(m_aMutex);
 
-        m_aDynamicProperties.addProperty( _rName, findFreeHandle(), 
_nAttributes, _rInitialValue );
+            // check whether the type is allowed, everything else will be 
checked
+            // by m_aDynamicProperties
+            const Type& aPropertyType = _rInitialValue.getValueType();
+            if (_rInitialValue.hasValue() && !m_aAllowedTypes.empty()
+                && m_aAllowedTypes.find(aPropertyType) == 
m_aAllowedTypes.end())
+                throw IllegalTypeException(OUString(), *this);
 
-        // our property info is dirty
-        m_pArrayHelper.reset();
+            m_aDynamicProperties.addProperty(_rName, findFreeHandle(), 
_nAttributes,
+                                             _rInitialValue);
 
-        g.clear();
+            // our property info is dirty
+            m_pArrayHelper.reset();
+        }
         setModified(true);
     }
 
 
     void SAL_CALL OPropertyBag::removeProperty( const OUString& _rName )
     {
-        ::osl::ClearableMutexGuard g( m_aMutex );
-
-        m_aDynamicProperties.removeProperty( _rName );
+        {
+            osl::MutexGuard g(m_aMutex);
 
-        // our property info is dirty
-        m_pArrayHelper.reset();
+            m_aDynamicProperties.removeProperty(_rName);
 
-        g.clear();
+            // our property info is dirty
+            m_pArrayHelper.reset();
+        }
         setModified(true);
     }
 
diff --git a/dbaccess/source/core/api/statement.cxx 
b/dbaccess/source/core/api/statement.cxx
index 3bad447db85f..beac6a16c13c 100644
--- a/dbaccess/source/core/api/statement.cxx
+++ b/dbaccess/source/core/api/statement.cxx
@@ -307,7 +307,7 @@ void OStatementBase::clearWarnings()
 void OStatementBase::cancel()
 {
     // no blocking as cancel is typically called from a different thread
-    ClearableMutexGuard aCancelGuard(m_aCancelMutex);
+    MutexGuard aCancelGuard(m_aCancelMutex);
     if (m_xAggregateAsCancellable.is())
         m_xAggregateAsCancellable->cancel();
     // else do nothing
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx 
b/dbaccess/source/core/dataaccess/databasedocument.cxx
index ad3713a1f43e..3c299261e438 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1804,52 +1804,54 @@ void ODatabaseDocument::disposing()
     std::vector< Reference< XInterface > > aKeepAlive;
 
     // SYNCHRONIZED ->
-    SolarMutexClearableGuard aGuard;
-
-    OSL_ENSURE( m_aControllers.empty(), "ODatabaseDocument::disposing: there 
still are controllers!" );
-    // normally, nobody should explicitly dispose, but only XCloseable::close
-    // the document. And upon closing, our controllers are closed, too
-
     {
-        uno::Reference<uno::XInterface> xUIInterface( 
m_xUIConfigurationManager );
-        aKeepAlive.push_back( xUIInterface );
-    }
-    m_xUIConfigurationManager = nullptr;
+        SolarMutexGuard aGuard;
 
-    clearObjectContainer( m_xForms );
-    clearObjectContainer( m_xReports );
+        OSL_ENSURE(m_aControllers.empty(),
+                   "ODatabaseDocument::disposing: there still are 
controllers!");
+        // normally, nobody should explicitly dispose, but only 
XCloseable::close
+        // the document. And upon closing, our controllers are closed, too
 
-    // reset the macro mode: in case the our impl struct stays alive (e.g. 
because our DataSource
-    // object still exists), and somebody subsequently re-opens the document, 
we want to have
-    // the security warning, again.
-    m_pImpl->resetMacroExecutionMode();
+        {
+            uno::Reference<uno::XInterface> 
xUIInterface(m_xUIConfigurationManager);
+            aKeepAlive.push_back(xUIInterface);
+        }
+        m_xUIConfigurationManager = nullptr;
 
-    // similar arguing for our ViewMonitor
-    m_aViewMonitor.reset();
+        clearObjectContainer(m_xForms);
+        clearObjectContainer(m_xReports);
 
-    // tell our Impl to forget us
-    m_pImpl->modelIsDisposing( impl_isInitialized(), 
ODatabaseModelImpl::ResetModelAccess() );
+        // reset the macro mode: in case the our impl struct stays alive (e.g. 
because our DataSource
+        // object still exists), and somebody subsequently re-opens the 
document, we want to have
+        // the security warning, again.
+        m_pImpl->resetMacroExecutionMode();
 
-    // now, at the latest, the controller array should be empty. Controllers 
are
-    // expected to listen for our disposal, and disconnect then
-    OSL_ENSURE( m_aControllers.empty(), "ODatabaseDocument::disposing: there 
still are controllers!" );
-    impl_disposeControllerFrames_nothrow();
+        // similar arguing for our ViewMonitor
+        m_aViewMonitor.reset();
 
-    {
-        uno::Reference<uno::XInterface> xModuleInterface( m_xModuleManager );
-        aKeepAlive.push_back( xModuleInterface );
-    }
-    m_xModuleManager.clear();
+        // tell our Impl to forget us
+        m_pImpl->modelIsDisposing(impl_isInitialized(), 
ODatabaseModelImpl::ResetModelAccess());
 
-    {
-        uno::Reference<uno::XInterface> xTitleInterface( m_xTitleHelper );
-        aKeepAlive.push_back( xTitleInterface );
-    }
-    m_xTitleHelper.clear();
+        // now, at the latest, the controller array should be empty. 
Controllers are
+        // expected to listen for our disposal, and disconnect then
+        OSL_ENSURE(m_aControllers.empty(),
+                   "ODatabaseDocument::disposing: there still are 
controllers!");
+        impl_disposeControllerFrames_nothrow();
 
-    m_pImpl.clear();
+        {
+            uno::Reference<uno::XInterface> xModuleInterface(m_xModuleManager);
+            aKeepAlive.push_back(xModuleInterface);
+        }
+        m_xModuleManager.clear();
 
-    aGuard.clear();
+        {
+            uno::Reference<uno::XInterface> xTitleInterface(m_xTitleHelper);
+            aKeepAlive.push_back(xTitleInterface);
+        }
+        m_xTitleHelper.clear();
+
+        m_pImpl.clear();
+    }
     // <- SYNCHRONIZED
 
     aKeepAlive.clear();
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx 
b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index 4acaa00fcc52..c099c0fe8e84 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -605,7 +605,7 @@ void ODefinitionContainer::approveNewObject(const OUString& 
_sName,const Referen
 // XPropertyChangeListener
 void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& 
evt )
 {
-    ClearableMutexGuard aGuard(m_aMutex);
+    MutexGuard aGuard(m_aMutex);
     if( evt.PropertyName == PROPERTY_NAME || evt.PropertyName ==  "Title" )
     {
         m_bInPropertyChange = true;
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx 
b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index bcb128145ffe..992eb24e5759 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -565,7 +565,7 @@ void SAL_CALL ODocumentContainer::insertByHierarchicalName( 
const OUString& _sNa
     if ( !xContent.is() )
         throw IllegalArgumentException();
 
-    ClearableMutexGuard aGuard(m_aMutex);
+    MutexGuard aGuard(m_aMutex);
     Any aContent;
     Reference< XNameContainer > xNameContainer(this);
     OUString sName;
@@ -589,7 +589,7 @@ void SAL_CALL ODocumentContainer::removeByHierarchicalName( 
const OUString& _sNa
     if ( _sName.isEmpty() )
         throw NoSuchElementException(_sName,*this);
 
-    ClearableMutexGuard aGuard(m_aMutex);
+    MutexGuard aGuard(m_aMutex);
     Any aContent;
     OUString sName;
     Reference< XNameContainer > xNameContainer(this);
@@ -606,7 +606,7 @@ void SAL_CALL 
ODocumentContainer::replaceByHierarchicalName( const OUString& _sN
     if ( !xContent.is() )
         throw IllegalArgumentException();
 
-    ClearableMutexGuard aGuard(m_aMutex);
+    MutexGuard aGuard(m_aMutex);
     Any aContent;
     OUString sName;
     Reference< XNameContainer > xNameContainer(this);
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx 
b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index c69d42b2418f..d367b058af44 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -959,7 +959,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& 
aCommand, sal_Int32 Co
         // making it release the own mutex before calling SolarMutex-code is 
... difficult, at least.
         // So, to be on the same side, we lock the SolarMutex here. Yes, it 
sucks.
         ::SolarMutexGuard aSolarGuard;
-        ::osl::ClearableMutexGuard aGuard(m_aMutex);
+        osl::MutexGuard aGuard(m_aMutex);
         if ( m_bInExecute )
             return aRet;
 
@@ -994,7 +994,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& 
aCommand, sal_Int32 Co
         return onCommandOpenSomething( aCommand.Argument, bActivateObject, 
Environment );
     }
 
-    ::osl::ClearableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
     if ( m_bInExecute )
         return aRet;
 
diff --git a/dbaccess/source/ui/misc/dbaundomanager.cxx 
b/dbaccess/source/ui/misc/dbaundomanager.cxx
index bff6e03b3609..76f6e7508b06 100644
--- a/dbaccess/source/ui/misc/dbaundomanager.cxx
+++ b/dbaccess/source/ui/misc/dbaundomanager.cxx
@@ -128,7 +128,7 @@ namespace dbaui
         virtual ::framework::IMutex& getGuardedMutex() override;
 
     private:
-        ::osl::ResettableMutexGuard m_aGuard;
+        osl::ClearableMutexGuard m_aGuard;
         OslMutexFacade              m_aMutexFacade;
     };
 
diff --git a/desktop/source/app/dispatchwatcher.cxx 
b/desktop/source/app/dispatchwatcher.cxx
index 872d98333982..5393b07e130d 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -406,7 +406,7 @@ bool DispatchWatcher::executeDispatchRequests( const 
std::vector<DispatchRequest
             if( xDispatcher.is() )
             {
                 {
-                    ::osl::ClearableMutexGuard aGuard(m_mutex);
+                    osl::MutexGuard aGuard(m_mutex);
                     // Remember request so we can find it in statusChanged!
                     m_nRequestCount++;
                 }
@@ -754,9 +754,10 @@ bool DispatchWatcher::executeDispatchRequests( const 
std::vector<DispatchRequest
                 xDisp->dispatchWithNotification( aDispatche.aURL, aArgs, this 
);
             else
             {
-                ::osl::ClearableMutexGuard aGuard(m_mutex);
-                m_nRequestCount--;
-                aGuard.clear();
+                {
+                    osl::MutexGuard aGuard(m_mutex);
+                    m_nRequestCount--;
+                }
                 xDispatch->dispatch( aDispatche.aURL, aArgs );
             }
         }
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx 
b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index c37ec6945d93..6e13917875c8 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -920,38 +920,39 @@ void ExtensionBox_Impl::addEntry( const uno::Reference< 
deployment::XPackage > &
     if ( pEntry->m_sTitle.isEmpty() )
         return;
 
-    ::osl::ClearableMutexGuard guard(m_entriesMutex);
-    if ( m_vEntries.empty() )
-    {
-        addEventListenerOnce(xPackage);
-        m_vEntries.push_back( pEntry );
-    }
-    else
     {
-        if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
+        osl::MutexGuard guard(m_entriesMutex);
+        if (m_vEntries.empty())
         {
             addEventListenerOnce(xPackage);
-            m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
+            m_vEntries.push_back(pEntry);
         }
-        else if ( !m_bInCheckMode )
+        else
         {
-            OSL_FAIL( "ExtensionBox_Impl::addEntry(): Will not add duplicate 
entries"  );
+            if (!FindEntryPos(pEntry, 0, m_vEntries.size() - 1, nPos))
+            {
+                addEventListenerOnce(xPackage);
+                m_vEntries.insert(m_vEntries.begin() + nPos, pEntry);
+            }
+            else if (!m_bInCheckMode)
+            {
+                OSL_FAIL("ExtensionBox_Impl::addEntry(): Will not add 
duplicate entries");
+            }
         }
-    }
 
-    pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
-    pEntry->m_bUser       = (xPackage->getRepositoryName() == 
USER_PACKAGE_MANAGER);
-    pEntry->m_bShared     = (xPackage->getRepositoryName() == 
SHARED_PACKAGE_MANAGER);
-    pEntry->m_bNew        = m_bInCheckMode;
-    pEntry->m_bMissingLic = bLicenseMissing;
+        pEntry->m_bHasOptions = m_pManager->supportsOptions(xPackage);
+        pEntry->m_bUser = (xPackage->getRepositoryName() == 
USER_PACKAGE_MANAGER);
+        pEntry->m_bShared = (xPackage->getRepositoryName() == 
SHARED_PACKAGE_MANAGER);
+        pEntry->m_bNew = m_bInCheckMode;
+        pEntry->m_bMissingLic = bLicenseMissing;
 
-    if ( bLicenseMissing )
-        pEntry->m_sErrorText = DpResId( RID_STR_ERROR_MISSING_LICENSE );
+        if (bLicenseMissing)
+            pEntry->m_sErrorText = DpResId(RID_STR_ERROR_MISSING_LICENSE);
 
-    //access to m_nActive must be guarded
-    if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
-        m_nActive += 1;
-    guard.clear();
+        //access to m_nActive must be guarded
+        if (!m_bInCheckMode && m_bHasActive && (m_nActive >= nPos))
+            m_nActive += 1;
+    }
 
     if ( IsReallyVisible() )
         Invalidate();
@@ -1087,47 +1088,50 @@ void ExtensionBox_Impl::checkEntries()
     long nPos = 0;
     bool bNeedsUpdate = false;
 
-    ::osl::ClearableMutexGuard guard(m_entriesMutex);
-    auto iIndex = m_vEntries.begin();
-    while ( iIndex != m_vEntries.end() )
     {
-        if ( !(*iIndex)->m_bChecked )
+        osl::MutexGuard guard(m_entriesMutex);
+        auto iIndex = m_vEntries.begin();
+        while (iIndex != m_vEntries.end())
         {
-            (*iIndex)->m_bChecked = true;
-            bNeedsUpdate = true;
-            nPos = iIndex-m_vEntries.begin();
-            if ( (*iIndex)->m_bNew )
-            { // add entry to list and correct active pos
-                if ( nNewPos == - 1)
-                    nNewPos = nPos;
-                if ( nPos <= m_nActive )
-                    m_nActive += 1;
-                ++iIndex;
-            }
-            else
-            {   // remove entry from list
-                if (nPos < nNewPos) {
-                    --nNewPos;
-                }
-                if (nPos < nChangedActivePos) {
-                    --nChangedActivePos;
+            if (!(*iIndex)->m_bChecked)
+            {
+                (*iIndex)->m_bChecked = true;
+                bNeedsUpdate = true;
+                nPos = iIndex - m_vEntries.begin();
+                if ((*iIndex)->m_bNew)
+                { // add entry to list and correct active pos
+                    if (nNewPos == -1)
+                        nNewPos = nPos;
+                    if (nPos <= m_nActive)
+                        m_nActive += 1;
+                    ++iIndex;
                 }
-                if ( nPos < m_nActive )
-                    m_nActive -= 1;
-                else if ( nPos == m_nActive )
-                {
-                    nChangedActivePos = nPos;
-                    m_nActive = -1;
-                    m_bHasActive = false;
+                else
+                { // remove entry from list
+                    if (nPos < nNewPos)
+                    {
+                        --nNewPos;
+                    }
+                    if (nPos < nChangedActivePos)
+                    {
+                        --nChangedActivePos;
+                    }
+                    if (nPos < m_nActive)
+                        m_nActive -= 1;
+                    else if (nPos == m_nActive)
+                    {
+                        nChangedActivePos = nPos;
+                        m_nActive = -1;
+                        m_bHasActive = false;
+                    }
+                    m_vRemovedEntries.push_back(*iIndex);
+                    iIndex = m_vEntries.erase(iIndex);
                 }
-                m_vRemovedEntries.push_back( *iIndex );
-                iIndex = m_vEntries.erase( iIndex );
             }
+            else
+                ++iIndex;
         }
-        else
-            ++iIndex;
     }
-    guard.clear();
 
     m_bInCheckMode = false;
 
diff --git a/desktop/source/offacc/acceptor.cxx 
b/desktop/source/offacc/acceptor.cxx
index d806ea7471e6..894f20623e78 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -134,7 +134,7 @@ void Acceptor::run()
 void Acceptor::initialize( const Sequence<Any>& aArguments )
 {
     // prevent multiple initialization
-    osl::ClearableMutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
     SAL_INFO( "desktop.offacc", "Acceptor::initialize()" );
 
     bool bOk = false;
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 195539060b81..64af4ce7fd6a 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -250,7 +250,7 @@ void SAL_CALL SplashScreen::setValue(sal_Int32 nValue)
 void SAL_CALL
 SplashScreen::initialize( const css::uno::Sequence< css::uno::Any>& aArguments 
)
 {
-    ::osl::ClearableMutexGuard  aGuard( _aMutex );
+    osl::MutexGuard  aGuard( _aMutex );
     if (aArguments.getLength() > 0)
     {
         aArguments[0] >>= _bVisible;
diff --git a/dtrans/source/win32/clipb/MtaOleClipb.cxx 
b/dtrans/source/win32/clipb/MtaOleClipb.cxx
index 8b1b07ec7ecd..ea9f6dfb380f 100644
--- a/dtrans/source/win32/clipb/MtaOleClipb.cxx
+++ b/dtrans/source/win32/clipb/MtaOleClipb.cxx
@@ -494,12 +494,10 @@ LRESULT CMtaOleClipboard::onClipboardUpdate()
     // registering ourself as clipboard
     if ( !m_bInRegisterClipViewer )
     {
-        ClearableMutexGuard aGuard( m_ClipboardChangedEventCountMutex );
+        MutexGuard aGuard( m_ClipboardChangedEventCountMutex );
 
         m_ClipboardChangedEventCount++;
         SetEvent( m_hClipboardChangedEvent );
-
-        aGuard.clear( );
     }
 
     return 0;
diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx 
b/dtrans/source/win32/clipb/WinClipbImpl.cxx
index 8df5db4a7d03..7ba04d13c4d8 100644
--- a/dtrans/source/win32/clipb/WinClipbImpl.cxx
+++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx
@@ -63,9 +63,10 @@ CWinClipbImpl::CWinClipbImpl( const OUString& 
aClipboardName, CWinClipboard* the
 
 CWinClipbImpl::~CWinClipbImpl( )
 {
-    ClearableMutexGuard aGuard( s_aMutex );
-    s_pCWinClipbImpl = nullptr;
-    aGuard.clear( );
+    {
+        MutexGuard aGuard(s_aMutex);
+        s_pCWinClipbImpl = nullptr;
+    }
 
     unregisterClipboardViewer( );
 }
@@ -74,16 +75,17 @@ Reference< XTransferable > CWinClipbImpl::getContents( )
 {
     // use the shortcut or create a transferable from
     // system clipboard
-    ClearableMutexGuard aGuard( m_ClipContentMutex );
-
-    if ( nullptr != m_pCurrentClipContent )
     {
-        return m_pCurrentClipContent->m_XTransferable;
-    }
+        MutexGuard aGuard(m_ClipContentMutex);
 
-    // release the mutex, so that the variable may be
-    // changed by other threads
-    aGuard.clear( );
+        if (nullptr != m_pCurrentClipContent)
+        {
+            return m_pCurrentClipContent->m_XTransferable;
+        }
+
+        // release the mutex, so that the variable may be
+        // changed by other threads
+    }
 
     Reference< XTransferable > rClipContent;
 
@@ -112,15 +114,14 @@ void CWinClipbImpl::setContents(
 
     if ( xTransferable.is( ) )
     {
-        ClearableMutexGuard aGuard( m_ClipContentMutex );
-
-        m_pCurrentClipContent = new CXNotifyingDataObject(
-            CDTransObjFactory::createDataObjFromTransferable( 
m_pWinClipboard->m_xContext , xTransferable ),
-            xTransferable,
-            xClipboardOwner,
-            this );
-
-        aGuard.clear( );
+        {
+            MutexGuard aGuard(m_ClipContentMutex);
+
+            m_pCurrentClipContent
+                = new 
CXNotifyingDataObject(CDTransObjFactory::createDataObjFromTransferable(
+                                                m_pWinClipboard->m_xContext, 
xTransferable),
+                                            xTransferable, xClipboardOwner, 
this);
+        }
 
         pIDataObj = IDataObjectPtr( m_pCurrentClipContent );
     }
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index a3319d7d828f..98f6a3d11d2b 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -510,7 +510,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 
nVerbID )
         // to get locking done right in this class, but that looks like a
         // daunting task
 
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard( m_aMutex );
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 2fa50bd452e0..06f24c9b080c 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -460,9 +460,7 @@ OleComponent::~OleComponent()
 
     if ( m_pOleWrapClientSite || m_pImplAdviseSink || m_pInterfaceContainer || 
m_bOleInitialized )
     {
-        ::osl::ClearableMutexGuard aGuard( m_aMutex );
-        m_refCount++;
-        aGuard.clear();
+        osl_atomic_increment(&m_refCount);
         try {
             Dispose();
         } catch( const uno::Exception& ) {}
@@ -1418,52 +1416,56 @@ void OleComponent::OnClose_Impl()
 
 void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership )
 {
-    ::osl::ClearableMutexGuard aGuard( m_aMutex );
-    if ( m_bDisposed )
-        throw lang::DisposedException(); // TODO
+    uno::Reference< uno::XInterface > xSelfHold;
+    {
+        osl::MutexGuard aGuard(m_aMutex);
+        if (m_bDisposed)
+            throw lang::DisposedException(); // TODO
 
-    uno::Reference< uno::XInterface > xSelfHold( static_cast< 
::cppu::OWeakObject* >( this ) );
-    lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
+        xSelfHold.set(static_cast<::cppu::OWeakObject*>(this));
+        lang::EventObject aSource(static_cast<::cppu::OWeakObject*>(this));
 
-    if ( m_pInterfaceContainer )
-    {
-        ::cppu::OInterfaceContainerHelper* pContainer =
-            m_pInterfaceContainer->getContainer( 
cppu::UnoType<util::XCloseListener>::get());
-        if ( pContainer != nullptr )
+        if (m_pInterfaceContainer)
         {
-            ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
-            while ( pIterator.hasMoreElements() )
+            ::cppu::OInterfaceContainerHelper* pContainer
+                = 
m_pInterfaceContainer->getContainer(cppu::UnoType<util::XCloseListener>::get());
+            if (pContainer != nullptr)
             {
-                try
+                ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+                while (pIterator.hasMoreElements())
                 {
-                    static_cast<util::XCloseListener*>( pIterator.next() 
)->queryClosing( aSource, bDeliverOwnership );
-                }
-                catch( const uno::RuntimeException& )
-                {
-                    pIterator.remove();
+                    try
+                    {
+                        static_cast<util::XCloseListener*>(pIterator.next())
+                            ->queryClosing(aSource, bDeliverOwnership);
+                    }
+                    catch (const uno::RuntimeException&)
+                    {
+                        pIterator.remove();
+                    }
                 }
             }
-        }
 
-        pContainer = m_pInterfaceContainer->getContainer(
-                                    
cppu::UnoType<util::XCloseListener>::get());
-        if ( pContainer != nullptr )
-        {
-            ::cppu::OInterfaceIteratorHelper pCloseIterator( *pContainer );
-            while ( pCloseIterator.hasMoreElements() )
+            pContainer
+                = 
m_pInterfaceContainer->getContainer(cppu::UnoType<util::XCloseListener>::get());
+            if (pContainer != nullptr)
             {
-                try
+                ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
+                while (pCloseIterator.hasMoreElements())
                 {
-                    static_cast<util::XCloseListener*>( pCloseIterator.next() 
)->notifyClosing( aSource );
-                }
-                catch( const uno::RuntimeException& )
-                {
-                    pCloseIterator.remove();
+                    try
+                    {
+                        
static_cast<util::XCloseListener*>(pCloseIterator.next())
+                            ->notifyClosing(aSource);
+                    }
+                    catch (const uno::RuntimeException&)
+                    {
+                        pCloseIterator.remove();
+                    }
                 }
             }
         }
     }
-    aGuard.clear();
 
     Dispose();
 }
diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index fddb668568b4..763ced642655 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -795,7 +795,7 @@ bool OleEmbeddedObject::SaveObject_Impl()
 
 bool OleEmbeddedObject::OnShowWindow_Impl( bool bShow )
 {
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard(m_aMutex);
 
     bool bResult = false;
 
@@ -1507,7 +1507,7 @@ void SAL_CALL OleEmbeddedObject::saveCompleted( sal_Bool 
bUseNew )
     }
     // end wrapping related part ====================
 
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard(m_aMutex);
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
@@ -1665,7 +1665,7 @@ void SAL_CALL OleEmbeddedObject::storeOwn()
     // ask container to store the object, the container has to make decision
     // to do so or not
 
-    ::osl::ResettableMutexGuard aGuard( m_aMutex );
+    osl::ClearableMutexGuard aGuard(m_aMutex);
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
diff --git a/extensions/source/update/check/updatecheck.cxx 
b/extensions/source/update/check/updatecheck.cxx
index 4306e073e26b..bbeaf3565cac 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -844,9 +844,10 @@ UpdateCheck::download()
         {
             shutdownThread(true);
 
-            osl::ClearableMutexGuard aGuard2(m_aMutex);
-            enableDownload(true);
-            aGuard2.clear();
+            {
+                osl::MutexGuard aGuard2(m_aMutex);
+                enableDownload(true);
+            }
             setUIState(UPDATESTATE_DOWNLOADING);
         }
     }
@@ -1051,7 +1052,7 @@ UpdateCheck::downloadTargetExists(const OUString& 
rFileName)
 
 bool UpdateCheck::checkDownloadDestination( const OUString& rFileName )
 {
-    osl::ClearableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
 
     rtl::Reference< UpdateHandler > aUpdateHandler( getUpdateHandler() );
 
diff --git a/filter/source/config/cache/basecontainer.cxx 
b/filter/source/config/cache/basecontainer.cxx
index 53e04e68ecf5..22565b276f65 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -55,7 +55,7 @@ void BaseContainer::init(const css::uno::Reference< 
css::uno::XComponentContext
                                FilterCache::EItemType                          
        eType              )
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     m_sImplementationName = sImplementationName;
     m_lServiceNames       = lServiceNames      ;
@@ -69,7 +69,7 @@ void BaseContainer::impl_loadOnDemand()
 {
 #ifdef LOAD_IMPLICIT
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // A generic container needs all items of a set of our cache!
     // Of course it can block for a while, till the cache is really filled.
@@ -104,7 +104,7 @@ void BaseContainer::impl_loadOnDemand()
 void BaseContainer::impl_initFlushMode()
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
     if (!m_pFlushCache)
         m_pFlushCache = TheFilterCache::get().clone();
     if (!m_pFlushCache)
@@ -117,7 +117,7 @@ void BaseContainer::impl_initFlushMode()
 FilterCache* BaseContainer::impl_getWorkingCache() const
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
     if (m_pFlushCache)
         return m_pFlushCache.get();
     else
@@ -164,7 +164,7 @@ void SAL_CALL BaseContainer::insertByName(const OUString& 
sItem ,
     impl_loadOnDemand();
 
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // create write copy of used cache on demand ...
     impl_initFlushMode();
@@ -173,8 +173,6 @@ void SAL_CALL BaseContainer::insertByName(const OUString& 
sItem ,
     if (pCache->hasItem(m_eType, sItem))
         throw css::container::ElementExistException(OUString(), static_cast< 
css::container::XNameContainer* >(this));
     pCache->setItem(m_eType, sItem, aItem);
-
-    aLock.clear();
     // <- SAFE ----------------------------------
 }
 
@@ -184,15 +182,13 @@ void SAL_CALL BaseContainer::removeByName(const OUString& 
sItem)
     impl_loadOnDemand();
 
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // create write copy of used cache on demand ...
     impl_initFlushMode();
 
     FilterCache* pCache = impl_getWorkingCache();
     pCache->removeItem(m_eType, sItem); // throw exceptions automatically
-
-    aLock.clear();
     // <- SAFE ----------------------------------
 }
 
@@ -218,7 +214,7 @@ void SAL_CALL BaseContainer::replaceByName(const OUString& 
sItem ,
     impl_loadOnDemand();
 
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // create write copy of used cache on demand ...
     impl_initFlushMode();
@@ -227,8 +223,6 @@ void SAL_CALL BaseContainer::replaceByName(const OUString& 
sItem ,
     if (!pCache->hasItem(m_eType, sItem))
         throw css::container::NoSuchElementException(OUString(), static_cast< 
css::container::XNameContainer* >(this));
     pCache->setItem(m_eType, sItem, aItem);
-
-    aLock.clear();
     // <- SAFE ----------------------------------
 }
 
@@ -244,7 +238,7 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const 
OUString& sItem)
     impl_loadOnDemand();
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     CacheItem aItem;
     try
@@ -277,7 +271,7 @@ css::uno::Sequence< OUString > SAL_CALL 
BaseContainer::getElementNames()
     impl_loadOnDemand();
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     try
     {
@@ -304,7 +298,7 @@ sal_Bool SAL_CALL BaseContainer::hasByName(const OUString& 
sItem)
     impl_loadOnDemand();
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     try
     {
@@ -338,7 +332,7 @@ sal_Bool SAL_CALL BaseContainer::hasElements()
     impl_loadOnDemand();
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     try
     {
@@ -373,7 +367,7 @@ css::uno::Reference< css::container::XEnumeration > 
SAL_CALL BaseContainer::crea
     impl_loadOnDemand();
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     try
     {
@@ -414,7 +408,7 @@ css::uno::Reference< css::container::XEnumeration > 
SAL_CALL BaseContainer::crea
 void SAL_CALL BaseContainer::flush()
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
 
     if (!m_pFlushCache)
         throw css::lang::WrappedTargetRuntimeException(
diff --git a/filter/source/config/cache/cacheupdatelistener.cxx 
b/filter/source/config/cache/cacheupdatelistener.cxx
index e380407eda3a..6625d4ee9286 100644
--- a/filter/source/config/cache/cacheupdatelistener.cxx
+++ b/filter/source/config/cache/cacheupdatelistener.cxx
@@ -50,7 +50,7 @@ CacheUpdateListener::~CacheUpdateListener()
 void CacheUpdateListener::startListening()
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
     css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, 
css::uno::UNO_QUERY);
     aLock.clear();
     // <- SAFE
@@ -66,7 +66,7 @@ void CacheUpdateListener::startListening()
 void CacheUpdateListener::stopListening()
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
     css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, 
css::uno::UNO_QUERY);
     aLock.clear();
     // <- SAFE
@@ -82,7 +82,7 @@ void CacheUpdateListener::stopListening()
 void SAL_CALL  CacheUpdateListener::changesOccurred(const 
css::util::ChangesEvent& aEvent)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
 
     // disposed ?
     if ( ! m_xConfig.is())
@@ -176,10 +176,9 @@ void SAL_CALL  CacheUpdateListener::changesOccurred(const 
css::util::ChangesEven
 void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& 
aEvent)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
     if (aEvent.Source == m_xConfig)
         m_xConfig.clear();
-    aLock.clear();
     // <- SAFE
 }
 
diff --git a/filter/source/config/cache/contenthandlerfactory.cxx 
b/filter/source/config/cache/contenthandlerfactory.cxx
index ae7b03c7cec9..11ad89a99474 100644
--- a/filter/source/config/cache/contenthandlerfactory.cxx
+++ b/filter/source/config/cache/contenthandlerfactory.cxx
@@ -57,7 +57,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL 
ContentHandlerFactory::crea
     css::uno::Reference< css::uno::XInterface > xHandler;
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     auto & cache = TheFilterCache::get();
 
diff --git a/filter/source/config/cache/filtercache.cxx 
b/filter/source/config/cache/filtercache.cxx
index 5a1fba1ed651..f717f109a26f 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -121,7 +121,7 @@ FilterCache::~FilterCache()
 std::unique_ptr<FilterCache> FilterCache::clone() const
 {
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     auto pClone = std::make_unique<FilterCache>();
 
@@ -153,7 +153,7 @@ std::unique_ptr<FilterCache> FilterCache::clone() const
 void FilterCache::takeOver(const FilterCache& rClone)
 {
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // a)
     // Don't copy the configuration access points here!
@@ -201,7 +201,7 @@ void FilterCache::takeOver(const FilterCache& rClone)
 void FilterCache::load(EFillState eRequired)
 {
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // check if required fill state is already reached ...
     // There is nothing to do then.
@@ -240,7 +240,7 @@ void FilterCache::load(EFillState eRequired)
 bool FilterCache::isFillState(FilterCache::EFillState eState) const
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
     return ((m_eFillState & eState) == eState);
     // <- SAFE
 }
@@ -251,7 +251,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( 
     EItemType  eTyp
                                                   const CacheItem& lEProps) 
const
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown - "eType" is unknown.
@@ -281,7 +281,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( 
     EItemType  eTyp
 bool FilterCache::hasItems(EItemType eType) const
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown - "eType" is unknown.
@@ -296,7 +296,7 @@ bool FilterCache::hasItems(EItemType eType) const
 std::vector<OUString> FilterCache::getItemNames(EItemType eType) const
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown - "eType" is unknown.
@@ -317,7 +317,7 @@ bool FilterCache::hasItem(      EItemType        eType,
                               const OUString& sItem)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown - "eType" is unknown.
@@ -349,7 +349,7 @@ CacheItem FilterCache::getItem(      EItemType        eType,
                                const OUString& sItem)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown if "eType" is unknown.
@@ -399,7 +399,7 @@ void FilterCache::removeItem(      EItemType        eType,
                              const OUString& sItem)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown - "eType" is unknown.
@@ -420,7 +420,7 @@ void FilterCache::setItem(      EItemType        eType ,
                           const CacheItem&       aValue)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // search for right list
     // An exception is thrown - "eType" is unknown.
@@ -447,7 +447,7 @@ void FilterCache::refreshItem(      EItemType        eType,
                               const OUString& sItem)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
     impl_loadItemOnDemand(eType, sItem);
 }
 
@@ -457,7 +457,7 @@ void FilterCache::addStatePropsToItem(      EItemType       
 eType,
                                             CacheItem&       rItem)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // Note: Opening of the configuration layer throws some exceptions
     // if it failed. So we mustn't check any reference here...
@@ -562,7 +562,7 @@ void FilterCache::removeStatePropsFromItem(CacheItem& rItem)
 void FilterCache::flush()
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // renew all dependencies and optimizations
     impl_validateAndOptimize();
@@ -664,7 +664,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& 
aURL      ,
     sExtension = sExtension.toAsciiLowerCase();
 
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
 
     // i) Step over all well known URL pattern
@@ -707,14 +707,13 @@ void FilterCache::detectFlatForURL(const css::util::URL& 
aURL      ,
         }
     }
 
-    aLock.clear();
     // <- SAFE ----------------------------------
 }
 
 const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const
 {
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     switch(eType)
     {
@@ -733,7 +732,7 @@ const CacheItemList& 
FilterCache::impl_getItemList(EItemType eType) const
 CacheItemList& FilterCache::impl_getItemList(EItemType eType)
 {
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     switch(eType)
     {
@@ -751,7 +750,7 @@ CacheItemList& FilterCache::impl_getItemList(EItemType 
eType)
 
 css::uno::Reference< css::uno::XInterface > 
FilterCache::impl_openConfig(EConfigProvider eProvider)
 {
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     OUString                              sPath      ;
     css::uno::Reference< css::uno::XInterface >* pConfig = nullptr;
@@ -877,7 +876,7 @@ css::uno::Reference< css::uno::XInterface > 
FilterCache::impl_createConfigAccess
                                                                                
        bool         bLocalesMode)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     css::uno::Reference< css::uno::XInterface > xCfg;
 
@@ -937,7 +936,7 @@ css::uno::Reference< css::uno::XInterface > 
FilterCache::impl_createConfigAccess
 void FilterCache::impl_validateAndOptimize()
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // First check if any filter or type could be read
     // from the underlying configuration!
@@ -1254,7 +1253,7 @@ FilterCache::EItemFlushState 
FilterCache::impl_specifyFlushOperation(const css::
 void FilterCache::impl_load(EFillState eRequiredState)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     // Attention: Detect services are part of the standard set!
     // So there is no need to handle it separately.
@@ -1467,7 +1466,7 @@ void FilterCache::impl_readPatchUINames(const 
css::uno::Reference< css::containe
 {
 
     // SAFE -> ----------------------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
     OUString sActLocale     = m_sActLocale    ;
     aLock.clear();
     // <- SAFE ----------------------------------
@@ -2203,14 +2202,15 @@ bool FilterCache::impl_isModuleInstalled(const 
OUString& sModule)
     css::uno::Reference< css::container::XNameAccess > xCfg;
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
-    if (! m_xModuleCfg.is())
     {
-        m_xModuleCfg = officecfg::Setup::Office::Factories::get();
-    }
+        osl::MutexGuard aLock(m_aLock);
+        if (!m_xModuleCfg.is())
+        {
+            m_xModuleCfg = officecfg::Setup::Office::Factories::get();
+        }
 
-    xCfg = m_xModuleCfg;
-    aLock.clear();
+        xCfg = m_xModuleCfg;
+    }
     // <- SAFE
 
     if (xCfg.is())
diff --git a/filter/source/config/cache/filterfactory.cxx 
b/filter/source/config/cache/filterfactory.cxx
index 8e559f2de666..743131a75313 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -74,7 +74,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL 
FilterFactory::createInstan
                                                                                
                 const css::uno::Sequence< css::uno::Any >& lArguments)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     auto & cache = TheFilterCache::get();
 
@@ -164,11 +164,12 @@ css::uno::Reference< css::container::XEnumeration > 
SAL_CALL FilterFactory::crea
     if (lTokens.valid())
     {
         // SAFE -> ----------------------
-        ::osl::ResettableMutexGuard aLock(m_aLock);
-        // May be not all filters was loaded ...
-        // But we need it now!
-        impl_loadOnDemand();
-        aLock.clear();
+        {
+            osl::MutexGuard aLock(m_aLock);
+            // May be not all filters was loaded ...
+            // But we need it now!
+            impl_loadOnDemand();
+        }
         // <- SAFE ----------------------
 
         if (lTokens.find(QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE) != 
lTokens.end())
@@ -251,7 +252,7 @@ std::vector<OUString> 
FilterFactory::impl_queryMatchByDocumentService(const Quer
         nEFlags = pIt->second.toInt32();
 
     // SAFE -> ----------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
 
     // search suitable filters
     FilterCache* pCache       = impl_getWorkingCache();
@@ -406,7 +407,7 @@ std::vector<OUString> 
FilterFactory::impl_getSortedFilterList(const QueryTokeniz
 std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const
 {
     // SAFE -> ----------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
     css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
     aLock.clear();
     // <- SAFE ----------------------
@@ -428,7 +429,7 @@ std::vector<OUString> 
FilterFactory::impl_getSortedFilterListForModule(const OUS
     lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule;
 
     // SAFE -> ----------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
     FilterCache* pCache        = impl_getWorkingCache();
     std::vector<OUString> lOtherFilters = 
pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
     aLock.clear();
@@ -469,7 +470,7 @@ std::vector<OUString> 
FilterFactory::impl_getSortedFilterListForModule(const OUS
 std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const 
OUString& sModule) const
 {
     // SAFE -> ----------------------
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::ClearableMutexGuard aLock(m_aLock);
     css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
     aLock.clear();
     // <- SAFE ----------------------
diff --git a/filter/source/config/cache/frameloaderfactory.cxx 
b/filter/source/config/cache/frameloaderfactory.cxx
index abf51d859baf..14b09a5fdb5a 100644
--- a/filter/source/config/cache/frameloaderfactory.cxx
+++ b/filter/source/config/cache/frameloaderfactory.cxx
@@ -54,7 +54,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL 
FrameLoaderFactory::createI
                                                                                
                      const css::uno::Sequence< css::uno::Any >& lArguments)
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     auto & cache = TheFilterCache::get();
 
diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 278f53eea11a..738f09a671c8 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -74,7 +74,7 @@ OUString SAL_CALL TypeDetection::queryTypeByURL(const 
OUString& sURL)
     OUString sType;
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
+    osl::MutexGuard aLock(m_aLock);
 
     css::util::URL  aURL;
     aURL.Complete = sURL;
@@ -379,7 +379,7 @@ OUString SAL_CALL 
TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::
     try
     {
         // SAFE -> ----------------------------------
-        ::osl::ResettableMutexGuard aLock(m_aLock);
+        osl::ClearableMutexGuard aLock(m_aLock);
 
         // parse given URL to split it into e.g. main and jump marks ...
         sURL = 
stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL(), 
OUString());
@@ -549,7 +549,7 @@ void 
TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
     try
     {
         // SAFE ->
-        ::osl::ResettableMutexGuard aLock(m_aLock);
+        osl::ClearableMutexGuard aLock(m_aLock);
 
         CacheItem aType = cache.getItem(FilterCache::E_TYPE, sType);
         aType[PROPNAME_PREFERREDFILTER] >>= sFilter;
@@ -644,9 +644,8 @@ bool TypeDetection::impl_getPreselectionForType(
     try
     {
         // SAFE -> --------------------------
-        ::osl::ResettableMutexGuard aLock(m_aLock);
+        osl::MutexGuard aLock(m_aLock);
         aType = TheFilterCache::get().getItem(FilterCache::E_TYPE, sType);
-        aLock.clear();
         // <- SAFE --------------------------
     }
     catch(const css::container::NoSuchElementException&)
@@ -731,7 +730,7 @@ void TypeDetection::impl_getPreselectionForDocumentService(
     try
     {
         // SAFE -> --------------------------
-        ::osl::ResettableMutexGuard aLock(m_aLock);
+        osl::MutexGuard aLock(m_aLock);
 
         // Attention: For executing next lines of code, We must be sure that
         // all filters already loaded :-(
@@ -742,8 +741,6 @@ void TypeDetection::impl_getPreselectionForDocumentService(
         CacheItem lIProps;
         lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService;
         lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, 
lIProps);
-
-        aLock.clear();
         // <- SAFE --------------------------
     }
     catch (const css::container::NoSuchElementException&)
@@ -905,7 +902,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep(      
utl::MediaDescriptor& r
         try
         {
             // SAFE -> ----------------------------------
-            ::osl::ResettableMutexGuard aLock(m_aLock);
+            osl::ClearableMutexGuard aLock(m_aLock);
             CacheItem aType = 
TheFilterCache::get().getItem(FilterCache::E_TYPE, sFlatType);
             aLock.clear();
 
@@ -986,9 +983,10 @@ OUString TypeDetection::impl_askDetectService(const 
OUString&               sDet
     css::uno::Reference< css::uno::XComponentContext >         xContext;
 
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
-    xContext = m_xContext;
-    aLock.clear();
+    {
+        osl::MutexGuard aLock(m_aLock);
+        xContext = m_xContext;
+    }
     // <- SAFE
 
     try
@@ -1158,13 +1156,14 @@ bool 
TypeDetection::impl_validateAndSetTypeOnDescriptor(      utl::MediaDescript
                                                             const OUString&    
           sType      )
 {
     // SAFE ->
-    ::osl::ResettableMutexGuard aLock(m_aLock);
-    if (TheFilterCache::get().hasItem(FilterCache::E_TYPE, sType))
     {
-        rDescriptor[utl::MediaDescriptor::PROP_TYPENAME()] <<= sType;
-        return true;
+        osl::MutexGuard aLock(m_aLock);
+        if (TheFilterCache::get().hasItem(FilterCache::E_TYPE, sType))
+        {
+            rDescriptor[utl::MediaDescriptor::PROP_TYPENAME()] <<= sType;
+            return true;
+        }
     }
-    aLock.clear();
     // <- SAFE
 
     // remove all related information from the descriptor
@@ -1179,7 +1178,7 @@ bool 
TypeDetection::impl_validateAndSetFilterOnDescriptor(      utl::MediaDescri
     try
     {
         // SAFE ->
-        ::osl::ResettableMutexGuard aLock(m_aLock);
+        osl::ClearableMutexGuard aLock(m_aLock);
 
         auto & cache = TheFilterCache::get();
         CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter);
diff --git a/forms/source/component/DatabaseForm.cxx 
b/forms/source/component/DatabaseForm.cxx
index 39bbcbf411de..30795285a12d 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -1877,7 +1877,7 @@ Any ODatabaseForm::getPropertyDefaultByHandle( sal_Int32 
nHandle ) const
 
 void SAL_CALL ODatabaseForm::reset()
 {
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::ClearableMutexGuard aGuard(m_aMutex);
 
     if (isLoaded())
     {
@@ -2304,7 +2304,7 @@ void ODatabaseForm::_propertyChanged(const 
PropertyChangeEvent& evt)
 void SAL_CALL ODatabaseForm::setParent(const 
css::uno::Reference<css::uno::XInterface>& Parent)
 {
     // SYNCHRONIZED ----->
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::ClearableMutexGuard aGuard(m_aMutex);
 
     Reference<XForm>  xParentForm(getParent(), UNO_QUERY);
     if (xParentForm.is())
@@ -2364,7 +2364,7 @@ void SAL_CALL ODatabaseForm::setParent(const 
css::uno::Reference<css::uno::XInte
 
 sal_Bool SAL_CALL ODatabaseForm::getGroupControl()
 {
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
 
     // Should controls be combined into a TabOrder group?
     if (m_aCycle.hasValue())
@@ -2383,7 +2383,7 @@ sal_Bool SAL_CALL ODatabaseForm::getGroupControl()
 
 void SAL_CALL ODatabaseForm::setControlModels(const 
Sequence<Reference<XControlModel> >& rControls)
 {
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
 
     // Set TabIndex in the order of the sequence
     sal_Int32 nCount = getCount();
@@ -2968,7 +2968,7 @@ void SAL_CALL ODatabaseForm::cursorMoved(const 
EventObject& /*event*/)
 {
     // reload the subform with the new parameters of the parent
     // do this handling delayed to provide of execute too many SQL Statements
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
 
     DBG_ASSERT( m_pLoadTimer, "ODatabaseForm::cursorMoved: how can this 
happen?!" );
     if ( !m_pLoadTimer )
@@ -3158,7 +3158,7 @@ sal_Bool SAL_CALL 
ODatabaseForm::approveRowSetChange(const EventObject& event)
 
 void SAL_CALL ODatabaseForm::addRowSetApproveListener(const 
Reference<XRowSetApproveListener>& _rListener)
 {
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
     m_aRowSetApproveListeners.addInterface(_rListener);
 
     // do we have to multiplex ?
@@ -3176,7 +3176,7 @@ void SAL_CALL 
ODatabaseForm::addRowSetApproveListener(const Reference<XRowSetApp
 
 void SAL_CALL ODatabaseForm::removeRowSetApproveListener(const 
Reference<XRowSetApproveListener>& _rListener)
 {
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
     // do we have to remove the multiplex ?
     m_aRowSetApproveListeners.removeInterface(_rListener);
     if ( m_aRowSetApproveListeners.getLength() == 0 )
@@ -3244,7 +3244,7 @@ void SAL_CALL ODatabaseForm::executeWithCompletion( const 
Reference< XInteractio
 
 void SAL_CALL ODatabaseForm::execute()
 {
-    ::osl::ResettableMutexGuard aGuard(m_aMutex);
+    osl::ClearableMutexGuard aGuard(m_aMutex);
     // if somebody calls an execute and we're not loaded we reroute this call 
to our load method.
 
     // the difference between execute and load is, that we position on the 
first row in case of load
diff --git a/forms/source/component/FormComponent.cxx 
b/forms/source/component/FormComponent.cxx
index 4ab830b7f5a4..0832a64031bf 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -1344,7 +1344,7 @@ void OBoundControlModel::disposing()
 {
     OControlModel::disposing();
 
-    ::osl::ClearableMutexGuard aGuard(m_aMutex);
+    osl::MutexGuard aGuard(m_aMutex);
 
     if ( m_pAggPropMultiplexer )
         m_pAggPropMultiplexer->dispose();
@@ -2697,7 +2697,7 @@ void OBoundControlModel::disconnectValidator( )
 
 void SAL_CALL OBoundControlModel::setValidator( const Reference< XValidator >& 
_rxValidator )
 {
-    ::osl::ClearableMutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
     OSL_PRECOND( m_bSupportsValidation, "OBoundControlModel::setValidator: How 
did you reach this method?" );
     // the interface for this method should not have been exposed if we do not
     // support validation
@@ -2733,7 +2733,7 @@ Reference< XValidator > SAL_CALL 
OBoundControlModel::getValidator(  )
 
 void SAL_CALL OBoundControlModel::validityConstraintChanged( const 
EventObject& /*Source*/ )
 {
-    ::osl::ClearableMutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
     OSL_PRECOND( m_bSupportsValidation, 
"OBoundControlModel::validityConstraintChanged: How did you reach this method?" 
);
     // the interface for this method should not have been exposed if we do not
     // support validation
diff --git a/forms/source/component/ListBox.cxx 
b/forms/source/component/ListBox.cxx
index fcf16abe66b4..9194f846692f 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -1907,7 +1907,7 @@ namespace frm
             m_aItemListeners.notifyEach( &XItemListener::itemStateChanged, 
_rEvent );
 
         // and do the handling for the ChangeListeners
-        ::osl::ClearableMutexGuard aGuard(m_aMutex);
+        osl::MutexGuard aGuard(m_aMutex);
         if ( m_aChangeIdle.IsActive() )
         {
             Reference<XPropertySet> xSet(getModel(), UNO_QUERY);
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx 
b/fpicker/source/win32/VistaFilePickerImpl.cxx
index 76e1062c7cfd..a2cc6d01468b 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -202,7 +202,7 @@ VistaFilePickerImpl::~VistaFilePickerImpl()
 void VistaFilePickerImpl::before()
 {
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     // TRICKY .-)
     // osl::Thread class initializes COm already in MTA mode because it's 
needed
@@ -336,7 +336,7 @@ void 
VistaFilePickerImpl::impl_sta_addFilePickerListener(const RequestRef& rRequ
         return;
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     TFileDialogEvents iHandler = m_iEventHandler;
     aLock.clear();
     // <- SYNCHRONIZED
@@ -355,7 +355,7 @@ void 
VistaFilePickerImpl::impl_sta_removeFilePickerListener(const RequestRef& rR
         return;
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     TFileDialogEvents iHandler = m_iEventHandler;
     aLock.clear();
     // <- SYNCHRONIZED
@@ -372,7 +372,7 @@ void VistaFilePickerImpl::impl_sta_appendFilter(const 
RequestRef& rRequest)
     const OUString sFilter = rRequest->getArgumentOrDefault(PROP_FILTER_VALUE, 
OUString());
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     m_lFilters.addFilter(sTitle, sFilter);
 }
@@ -384,7 +384,7 @@ void VistaFilePickerImpl::impl_sta_appendFilterGroup(const 
RequestRef& rRequest)
         rRequest->getArgumentOrDefault(PROP_FILTER_GROUP, css::uno::Sequence< 
css::beans::StringPair >());
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     if ( m_lFilters.numFilter() > 0 && aFilterGroup.getLength() > 0 )
         m_lFilters.addFilter( STRING_SEPARATOR, "", true );
@@ -404,7 +404,7 @@ void VistaFilePickerImpl::impl_sta_setCurrentFilter(const 
RequestRef& rRequest)
     const OUString sTitle  = rRequest->getArgumentOrDefault(PROP_FILTER_TITLE, 
OUString());
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     m_lFilters.setCurrentFilter(sTitle);
 }
@@ -422,7 +422,7 @@ void VistaFilePickerImpl::impl_sta_getCurrentFilter(const 
RequestRef& rRequest)
         return;
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     OUString sTitle;
     ::sal_Int32     nRealIndex = nIndex-1; // COM dialog base on 1 ... filter 
container on 0 .-)
@@ -436,8 +436,6 @@ void VistaFilePickerImpl::impl_sta_getCurrentFilter(const 
RequestRef& rRequest)
         sTitle = m_lFilters.getCurrentFilter();
         rRequest->setArgument(PROP_FILTER_TITLE, sTitle);
     }
-
-    aLock.clear();
     // <- SYNCHRONIZED
 }
 
@@ -445,7 +443,7 @@ void VistaFilePickerImpl::impl_sta_getCurrentFilter(const 
RequestRef& rRequest)
 void VistaFilePickerImpl::impl_sta_CreateDialog(const RequestRef& rRequest, 
PickerDialog eType, DWORD nOrFlags)
 {
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
 
     TFileDialog iDialog;
 
@@ -710,7 +708,7 @@ void 
VistaFilePickerImpl::impl_sta_SetMultiSelectionMode(const RequestRef& rRequ
     const bool bMultiSelection = 
rRequest->getArgumentOrDefault(PROP_MULTISELECTION_MODE, true);
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     TFileDialog iDialog = impl_getBaseDialogInterface();
     aLock.clear();
     // <- SYNCHRONIZED
@@ -732,7 +730,7 @@ void VistaFilePickerImpl::impl_sta_SetTitle(const 
RequestRef& rRequest)
     OUString sTitle = rRequest->getArgumentOrDefault(PROP_TITLE, OUString());
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     TFileDialog iDialog = impl_getBaseDialogInterface();
     aLock.clear();
     // <- SYNCHRONIZED
@@ -746,7 +744,7 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const 
RequestRef& rRequest)
     OUString sFileName = rRequest->getArgumentOrDefault(PROP_FILENAME, 
OUString());
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     TFileDialog iDialog = impl_getBaseDialogInterface();
     aLock.clear();
     // <- SYNCHRONIZED
@@ -771,7 +769,7 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const 
RequestRef& rRequest)
     }
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     TFileDialog iDialog = impl_getBaseDialogInterface();
     aLock.clear();
     // <- SYNCHRONIZED
@@ -832,7 +830,7 @@ void VistaFilePickerImpl::impl_sta_SetDefaultName(const 
RequestRef& rRequest)
 void VistaFilePickerImpl::impl_sta_setFiltersOnDialog()
 {
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
 
     std::vector<OUString> vStrings; // to hold the adjusted filter names, 
pointers to which will be
                                     // stored in lFilters
@@ -873,7 +871,7 @@ void VistaFilePickerImpl::impl_sta_setFiltersOnDialog()
 void VistaFilePickerImpl::impl_sta_getSelectedFiles(const RequestRef& rRequest)
 {
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
 
     TFileOpenDialog iOpen      = m_iDialogOpen;
     TFileSaveDialog iSave      = m_iDialogSave;
@@ -1067,7 +1065,7 @@ TFileDialog 
VistaFilePickerImpl::impl_getBaseDialogInterface()
     TFileDialog iDialog;
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     if (m_iDialogOpen.is())
         m_iDialogOpen.query(&iDialog);
@@ -1085,7 +1083,7 @@ TFileDialogCustomize 
VistaFilePickerImpl::impl_getCustomizeInterface()
     TFileDialogCustomize iCustom;
 
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     if (m_iDialogOpen.is())
         m_iDialogOpen.query(&iCustom);
@@ -1298,7 +1296,7 @@ void VistaFilePickerImpl::impl_SetDefaultExtension( const 
OUString& currentFilte
 void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
 {
     // SYNCHRONIZED->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
 
     const OUString sFilter = m_lFilters.getCurrentFilter ();
     OUString sExt    ;
diff --git a/fpicker/source/win32/asyncrequests.cxx 
b/fpicker/source/win32/asyncrequests.cxx
index cdcfb6d630e9..86b71cf51540 100644
--- a/fpicker/source/win32/asyncrequests.cxx
+++ b/fpicker/source/win32/asyncrequests.cxx
@@ -75,9 +75,10 @@ AsyncRequests::AsyncRequests(const RequestHandlerRef& 
rHandler)
 AsyncRequests::~AsyncRequests()
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
-    m_bFinish = true;
-    aLock.clear();
+    {
+        osl::MutexGuard aLock(m_aMutex);
+        m_bFinish = true;
+    }
     // <- SYNCHRONIZED
 
     // The static AsyncRequests aNotify in 
VistaFilePickerEventHandler::impl_sendEvent
@@ -106,9 +107,10 @@ void AsyncRequests::triggerJobExecution()
 void AsyncRequests::triggerRequestProcessMessages (const RequestRef& rRequest)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
-    m_lRequests.push(rRequest);
-    aLock.clear();
+    {
+        osl::MutexGuard aLock(m_aMutex);
+        m_lRequests.push(rRequest);
+    }
     // <- SYNCHRONIZED
 
     rRequest->waitProcessMessages();
@@ -117,9 +119,10 @@ void AsyncRequests::triggerRequestProcessMessages (const 
RequestRef& rRequest)
 void AsyncRequests::triggerRequestBlocked(const RequestRef& rRequest)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
-    m_lRequests.push(rRequest);
-    aLock.clear();
+    {
+        osl::MutexGuard aLock(m_aMutex);
+        m_lRequests.push(rRequest);
+    }
     // <- SYNCHRONIZED
 
     triggerJobExecution();
@@ -130,9 +133,10 @@ void AsyncRequests::triggerRequestBlocked(const 
RequestRef& rRequest)
 void AsyncRequests::triggerRequestNonBlocked(const RequestRef& rRequest)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
-    m_lRequests.push(rRequest);
-    aLock.clear();
+    {
+        osl::MutexGuard aLock(m_aMutex);
+        m_lRequests.push(rRequest);
+    }
     // <- SYNCHRONIZED
 
     triggerJobExecution();
@@ -141,7 +145,7 @@ void AsyncRequests::triggerRequestNonBlocked(const 
RequestRef& rRequest)
 void AsyncRequests::triggerRequestDirectly(const RequestRef& rRequest)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::ClearableMutexGuard aLock(m_aMutex);
     RequestHandlerRef rHandler = m_rHandler;
     aLock.clear();
     // <- SYNCHRONIZED
diff --git a/framework/source/accelerators/storageholder.cxx 
b/framework/source/accelerators/storageholder.cxx
index d6f52ffcff72..ca807eabf684 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -208,9 +208,10 @@ void StorageHolder::commitPath(const OUString& sPath)
     }
 
     // SAFE -> ------------------------------
-    osl::ClearableMutexGuard aReadLock(m_mutex);
-    xCommit.set(m_xRoot, css::uno::UNO_QUERY);
-    aReadLock.clear();
+    {
+        osl::MutexGuard aReadLock(m_mutex);
+        xCommit.set(m_xRoot, css::uno::UNO_QUERY);
+    }
     // <- SAFE ------------------------------
 
     if (xCommit.is())
@@ -345,25 +346,25 @@ css::uno::Reference< css::embed::XStorage > 
StorageHolder::getParentStorage(cons
         return css::uno::Reference< css::embed::XStorage >();
 
     // SAFE -> ----------------------------------
-    osl::ClearableMutexGuard aReadLock(m_mutex);
-
-    // b)
-    if (c < 2)
-        return m_xRoot;
-
-    // c)
-    OUStringBuffer sParentPath;
-    sal_Int32       i = 0;
-    for (i=0; i<c-1; ++i)
     {
-        sParentPath.append(lFolders[i]).append(PATH_SEPARATOR);
-    }
+        osl::MutexGuard aReadLock(m_mutex);
 
-    TPath2StorageInfo::const_iterator pParent = 
m_lStorages.find(sParentPath.makeStringAndClear());
-    if (pParent != m_lStorages.end())
-        return pParent->second.Storage;
+        // b)
+        if (c < 2)
+            return m_xRoot;
 
-    aReadLock.clear();
+        // c)
+        OUStringBuffer sParentPath;
+        sal_Int32       i = 0;
+        for (i = 0; i < c - 1; ++i)
+        {
+            sParentPath.append(lFolders[i]).append(PATH_SEPARATOR);
+        }
+
+        auto pParent = m_lStorages.find(sParentPath.makeStringAndClear());
+        if (pParent != m_lStorages.end())
+            return pParent->second.Storage;
+    }
     // <- SAFE ----------------------------------
 
     // ?
diff --git a/framework/source/dispatch/interceptionhelper.cxx 
b/framework/source/dispatch/interceptionhelper.cxx
index 9a98285ec720..bca143bc92a3 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -40,40 +40,40 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL 
InterceptionHelper::queryD
                                                                                
         const OUString& sTargetFrameName,
                                                                                
               sal_Int32        nSearchFlags    )
 {
+    css::uno::Reference<css::frame::XDispatchProvider> xInterceptor;
     // SAFE {
-    SolarMutexClearableGuard aReadLock;
+    {
+        SolarMutexGuard aReadLock;
 
-    // a) first search an interceptor, which match to this URL by its URL 
pattern registration
-    //    Note: if it return NULL - it does not mean an empty interceptor list 
automatically!
-    css::uno::Reference< css::frame::XDispatchProvider > xInterceptor;
-    InterceptorList::const_iterator pIt = 
m_lInterceptionRegs.findByPattern(aURL.Complete);
-    if (pIt != m_lInterceptionRegs.end())
-        xInterceptor = pIt->xInterceptor;
+        // a) first search an interceptor, which match to this URL by its URL 
pattern registration
+        //    Note: if it return NULL - it does not mean an empty interceptor 
list automatically!
+        InterceptorList::const_iterator pIt = 
m_lInterceptionRegs.findByPattern(aURL.Complete);
+        if (pIt != m_lInterceptionRegs.end())
+            xInterceptor = pIt->xInterceptor;
 
-    // b) No match by registration - but a valid interceptor list.
-    //    Find first interceptor w/o pattern, so we need to query it
-    if (!xInterceptor.is())
-    {
-        for (auto const& lInterceptionReg : m_lInterceptionRegs)
+        // b) No match by registration - but a valid interceptor list.
+        //    Find first interceptor w/o pattern, so we need to query it
+        if (!xInterceptor.is())
         {
-            if (!lInterceptionReg.lURLPattern.getLength())
+            for (auto const& lInterceptionReg : m_lInterceptionRegs)
             {
-                // no pattern -> need to ask this guy!
-                xInterceptor = lInterceptionReg.xInterceptor;
-                break;
+                if (!lInterceptionReg.lURLPattern.getLength())
+                {
+                    // no pattern -> need to ask this guy!
+                    xInterceptor = lInterceptionReg.xInterceptor;
+                    break;
+                }
             }
+            // if we didn't find any non-pattern interceptor, there's no-one
+            // registered for this command url (we already searched for 
matching
+            // patterns above)
         }
-        // if we didn't find any non-pattern interceptor, there's no-one
-        // registered for this command url (we already searched for matching
-        // patterns above)
+        // c) No registered interceptor => use our direct slave.
+        //    This helper exist by design and must be valid everytimes ...
+        //    But to be more feature proof - we should check that .-)
+        if (!xInterceptor.is() && m_xSlave.is())
+            xInterceptor = m_xSlave;
     }
-    // c) No registered interceptor => use our direct slave.
-    //    This helper exist by design and must be valid everytimes ...
-    //    But to be more feature proof - we should check that .-)
-    if (!xInterceptor.is() && m_xSlave.is())
-        xInterceptor = m_xSlave;
-
-    aReadLock.clear();
     // } SAFE
 
     css::uno::Reference< css::frame::XDispatch > xReturn;
diff --git a/framework/source/fwe/helper/titlehelper.cxx 
b/framework/source/fwe/helper/titlehelper.cxx
index cd7551882e89..c15098ed8901 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -69,7 +69,7 @@ void TitleHelper::setOwner(const css::uno::Reference< 
css::uno::XInterface >& xO
 {
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         m_xOwner = xOwner;
     }
@@ -100,7 +100,7 @@ void TitleHelper::setOwner(const css::uno::Reference< 
css::uno::XInterface >& xO
 OUString SAL_CALL TitleHelper::getTitle()
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     // An external title will win always and disable all internal logic about
     // creating/using a title value.
@@ -122,7 +122,7 @@ OUString SAL_CALL TitleHelper::getTitle()
 void TitleHelper::connectWithUntitledNumbers (const css::uno::Reference< 
css::frame::XUntitledNumbers >& xNumbers)
 {
     // SYNCHRONIZED ->
-    ::osl::ResettableMutexGuard aLock(m_aMutex);
+    osl::MutexGuard aLock(m_aMutex);
 
     m_xUntitledNumbers = xNumbers;
     // <- SYNCHRONIZED
@@ -132,7 +132,7 @@ void SAL_CALL TitleHelper::setTitle(const OUString& sTitle)
 {
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         m_bExternalTitle = true;
         m_sTitle         = sTitle;
@@ -159,7 +159,7 @@ void SAL_CALL TitleHelper::titleChanged(const 
css::frame::TitleChangedEvent& aEv
     css::uno::Reference< css::frame::XTitle > xSubTitle;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xSubTitle.set(m_xSubTitle.get (), css::uno::UNO_QUERY);
     }
@@ -181,7 +181,7 @@ void SAL_CALL TitleHelper::documentEventOccured(const 
css::document::DocumentEve
     css::uno::Reference< css::frame::XModel > xOwner;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
     }
@@ -203,7 +203,7 @@ void SAL_CALL TitleHelper::frameAction(const 
css::frame::FrameActionEvent& aEven
     css::uno::Reference< css::frame::XFrame > xOwner;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
     }
@@ -232,7 +232,7 @@ void SAL_CALL TitleHelper::disposing(const 
css::lang::EventObject& aEvent)
     ::sal_Int32                                         nLeasedNumber;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xOwner.set(m_xOwner.get()          , css::uno::UNO_QUERY);
         xNumbers.set(m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
@@ -254,7 +254,7 @@ void SAL_CALL TitleHelper::disposing(const 
css::lang::EventObject& aEvent)
 
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         m_xOwner        = nullptr;
         m_sTitle        = OUString ();
@@ -268,7 +268,7 @@ void TitleHelper::impl_sendTitleChangedEvent ()
     css::uno::Reference<css::uno::XInterface> xOwner;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xOwner = m_xOwner;
     }
@@ -304,7 +304,7 @@ void TitleHelper::impl_updateTitle (bool init)
     css::uno::Reference< css::frame::XFrame >      xFrame;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xModel.set     (m_xOwner.get(), css::uno::UNO_QUERY);
         xController.set(m_xOwner.get(), css::uno::UNO_QUERY);
@@ -333,7 +333,7 @@ void TitleHelper::impl_updateTitleForModel (const 
css::uno::Reference< css::fram
     ::sal_Int32                                         nLeasedNumber;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         // external title won't be updated internally!
         // It has to be set from outside new.
@@ -394,7 +394,7 @@ void TitleHelper::impl_updateTitleForModel (const 
css::uno::Reference< css::fram
     bool     bChanged;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         // WORKAROUND: the notification is currently sent always,
         //             can be changed after shared mode is supported per UNO 
API
@@ -416,7 +416,7 @@ void TitleHelper::impl_updateTitleForController (const 
css::uno::Reference< css:
     ::sal_Int32                                         nLeasedNumber;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         // external title won't be updated internally!
         // It has to be set from outside new.
@@ -476,7 +476,7 @@ void TitleHelper::impl_updateTitleForController (const 
css::uno::Reference< css:
     bool     bChanged;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         OUString sNewTitle       = sTitle.makeStringAndClear ();
         bChanged        = !init && m_sTitle != sNewTitle;
@@ -496,7 +496,7 @@ void TitleHelper::impl_updateTitleForFrame (const 
css::uno::Reference< css::fram
 
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         // external title won't be updated internally!
         // It has to be set from outside new.
@@ -525,7 +525,7 @@ void TitleHelper::impl_updateTitleForFrame (const 
css::uno::Reference< css::fram
     bool     bChanged;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         OUString sNewTitle = sTitle.makeStringAndClear ();
         bChanged  = !init && m_sTitle != sNewTitle;
@@ -564,7 +564,7 @@ void TitleHelper::impl_appendModuleName (OUStringBuffer& 
sTitle)
     css::uno::Reference< css::uno::XComponentContext > xContext;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         xOwner   = m_xOwner.get();
         xContext = m_xContext;
@@ -652,7 +652,7 @@ void TitleHelper::impl_setSubTitle (const 
css::uno::Reference< css::frame::XTitl
     css::uno::Reference< css::frame::XTitle > xOldSubTitle;
     // SYNCHRONIZED ->
     {
-        ::osl::ResettableMutexGuard aLock(m_aMutex);
+        osl::MutexGuard aLock(m_aMutex);
 
         // ignore duplicate calls. Makes outside using of this helper more 
easy :-)
         xOldSubTitle.set(m_xSubTitle.get(), css::uno::UNO_QUERY);
diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx 
b/framework/source/fwi/threadhelp/transactionmanager.cxx
index 5510a24ee96e..5d78b81a9324 100644
--- a/framework/source/fwi/threadhelp/transactionmanager.cxx
+++ b/framework/source/fwi/threadhelp/transactionmanager.cxx
@@ -71,29 +71,29 @@ TransactionManager::~TransactionManager()
 void  TransactionManager::setWorkingMode( EWorkingMode eMode )
 {
     // Safe member access.
-    ::osl::ClearableMutexGuard  aAccessGuard( m_aAccessLock );
-    bool                        bWaitFor    = false;
-    // Change working mode first!
-    if  (
-            ( m_eWorkingMode == E_INIT        && eMode == E_WORK        ) ||
-            ( (m_eWorkingMode == E_WORK || m_eWorkingMode == E_INIT) && eMode 
== E_BEFORECLOSE ) ||
-            ( m_eWorkingMode == E_BEFORECLOSE && eMode == E_CLOSE       ) ||
-            ( m_eWorkingMode == E_CLOSE       && eMode == E_INIT        )
-        )
+    bool bWaitFor = false;
     {
-        m_eWorkingMode = eMode;
-        if( m_eWorkingMode == E_BEFORECLOSE || m_eWorkingMode == E_CLOSE )
+        osl::MutexGuard aAccessGuard(m_aAccessLock);
+        // Change working mode first!
+        if (
+            (m_eWorkingMode == E_INIT && eMode == E_WORK) ||

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to