summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/preventduplicateinteraction.cxx25
-rw-r--r--sfx2/source/appl/shutdownicon.cxx6
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx38
-rw-r--r--sfx2/source/doc/doctemplates.cxx9
-rw-r--r--sfx2/source/inc/docundomanager.hxx2
-rw-r--r--sfx2/source/notify/globalevents.cxx45
6 files changed, 56 insertions, 69 deletions
diff --git a/sfx2/source/appl/preventduplicateinteraction.cxx b/sfx2/source/appl/preventduplicateinteraction.cxx
index f9c38dd81132..3f34743891d3 100644
--- a/sfx2/source/appl/preventduplicateinteraction.cxx
+++ b/sfx2/source/appl/preventduplicateinteraction.cxx
@@ -41,20 +41,14 @@ PreventDuplicateInteraction::~PreventDuplicateInteraction()
void PreventDuplicateInteraction::setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler)
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
m_xWarningDialogsParent.reset();
m_xHandler = xHandler;
- aLock.clear();
// <- SAFE
}
void PreventDuplicateInteraction::useDefaultUUIHandler()
{
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
- aLock.clear();
- // <- SAFE
-
//if we use the default handler, set the parent to a window belonging to this object so that the dialogs
//don't block unrelated windows.
m_xWarningDialogsParent.reset(new WarningDialogsParentScope(m_xContext));
@@ -62,9 +56,8 @@ void PreventDuplicateInteraction::useDefaultUUIHandler()
m_xContext, m_xWarningDialogsParent->GetDialogParent()), css::uno::UNO_QUERY_THROW);
// SAFE ->
- aLock.reset();
+ osl::MutexGuard aLock(m_aLock);
m_xHandler = xHandler;
- aLock.clear();
// <- SAFE
}
@@ -72,7 +65,7 @@ css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::u
{
if ( aType.equals( cppu::UnoType<XInteractionHandler2>::get() ) )
{
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY );
if ( !xHandler.is() )
return css::uno::Any();
@@ -86,7 +79,7 @@ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css
bool bHandleIt = true;
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::ClearableMutexGuard aLock(m_aLock);
auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(),
[&aRequest](const InteractionInfo& rInfo) { return aRequest.isExtractableTo(rInfo.m_aInteraction); });
@@ -131,7 +124,7 @@ sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const c
bool bHandleIt = true;
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::ClearableMutexGuard aLock(m_aLock);
auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(),
[&aRequest](const InteractionInfo& rInfo) { return aRequest.isExtractableTo(rInfo.m_aInteraction); });
@@ -176,7 +169,7 @@ sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const c
void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo)
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(),
[&aInteractionInfo](const InteractionInfo& rInfo) { return rInfo.m_aInteraction == aInteractionInfo.m_aInteraction; });
@@ -189,8 +182,6 @@ void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInter
}
m_lInteractionRules.push_back(aInteractionInfo);
-
- aLock.clear();
// <- SAFE
}
@@ -198,7 +189,7 @@ bool PreventDuplicateInteraction::getInteractionInfo(const css::uno::Type&
PreventDuplicateInteraction::InteractionInfo* pReturn ) const
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(),
[&aInteraction](const InteractionInfo& rInfo) { return rInfo.m_aInteraction == aInteraction; });
@@ -207,8 +198,6 @@ bool PreventDuplicateInteraction::getInteractionInfo(const css::uno::Type&
*pReturn = *pIt;
return true;
}
-
- aLock.clear();
// <- SAFE
return false;
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index b0e8792d8b37..6693dd5235f0 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -507,10 +507,8 @@ ShutdownIcon* ShutdownIcon::createInstance()
void ShutdownIcon::init()
{
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- aGuard.clear();
css::uno::Reference < XDesktop2 > xDesktop = Desktop::create( m_xContext );
- aGuard.reset();
+ osl::MutexGuard aGuard(m_aMutex);
m_xDesktop = xDesktop;
}
@@ -534,7 +532,7 @@ void SAL_CALL ShutdownIcon::disposing( const css::lang::EventObject& )
void SAL_CALL ShutdownIcon::queryTermination( const css::lang::EventObject& )
{
SAL_INFO("sfx.appl", "ShutdownIcon::queryTermination: veto is " << m_bVeto);
- ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
if ( m_bVeto )
throw css::frame::TerminationVetoException();
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index fff048706fad..43a3f2bbf4ff 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1616,28 +1616,30 @@ void SAL_CALL
SfxDocumentMetaData::setDocumentStatistics(
const css::uno::Sequence< css::beans::NamedValue > & the_value)
{
- ::osl::ClearableMutexGuard g(m_aMutex);
- checkInit();
- std::vector<std::pair<const char *, OUString> > attributes;
- for (sal_Int32 i = 0; i < the_value.getLength(); ++i) {
- const OUString name = the_value[i].Name;
- // inefficiently search for matching attribute
- for (size_t j = 0; s_stdStats[j] != nullptr; ++j) {
- if (name.equalsAscii(s_stdStats[j])) {
- const css::uno::Any any = the_value[i].Value;
- sal_Int32 val = 0;
- if (any >>= val) {
- attributes.emplace_back(s_stdStatAttrs[j],
- OUString::number(val));
- } else {
- SAL_WARN("sfx.doc", "Invalid statistic: " << name);
+ {
+ osl::MutexGuard g(m_aMutex);
+ checkInit();
+ std::vector<std::pair<const char *, OUString> > attributes;
+ for (sal_Int32 i = 0; i < the_value.getLength(); ++i) {
+ const OUString name = the_value[i].Name;
+ // inefficiently search for matching attribute
+ for (size_t j = 0; s_stdStats[j] != nullptr; ++j) {
+ if (name.equalsAscii(s_stdStats[j])) {
+ const css::uno::Any any = the_value[i].Value;
+ sal_Int32 val = 0;
+ if (any >>= val) {
+ attributes.emplace_back(s_stdStatAttrs[j],
+ OUString::number(val));
+ }
+ else {
+ SAL_WARN("sfx.doc", "Invalid statistic: " << name);
+ }
+ break;
}
- break;
}
}
+ updateElement("meta:document-statistic", &attributes);
}
- updateElement("meta:document-statistic", &attributes);
- g.clear();
setModified(true);
}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 54adf06ba8b0..31f2a7e7951b 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -450,11 +450,10 @@ void SfxDocTplService_Impl::init_Impl()
VclPtrInstance< WaitWindow_Impl > pWin;
aSolarGuard.clear();
- ::osl::ClearableMutexGuard anotherGuard( maMutex );
-
- update();
-
- anotherGuard.clear();
+ {
+ osl::MutexGuard anotherGuard(maMutex);
+ update();
+ }
SolarMutexGuard aSecondSolarGuard;
pWin.disposeAndClear();
diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx
index 580a865c8a8f..ab713c1d50e2 100644
--- a/sfx2/source/inc/docundomanager.hxx
+++ b/sfx2/source/inc/docundomanager.hxx
@@ -90,7 +90,7 @@ public:
}
private:
- SolarMutexResettableGuard m_aGuard;
+ SolarMutexClearableGuard m_aGuard;
};
namespace sfx2
diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx
index 844fd7a676bd..6dd0340eb22d 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ b/sfx2/source/notify/globalevents.cxx
@@ -152,7 +152,7 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const uno::Reference < uno::XCompone
uno::Reference< container::XNameReplace > SAL_CALL SfxGlobalEvents_Impl::getEvents()
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
return m_xEvents;
// <- SAFE
}
@@ -214,11 +214,10 @@ void SAL_CALL SfxGlobalEvents_Impl::disposing(const lang::EventObject& aEvent)
uno::Reference< frame::XModel > xDoc(aEvent.Source, uno::UNO_QUERY);
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
TModelList::iterator pIt = impl_searchDoc(xDoc);
if (pIt != m_lModels.end())
m_lModels.erase(pIt);
- aLock.clear();
// <- SAFE
}
@@ -231,11 +230,10 @@ sal_Bool SAL_CALL SfxGlobalEvents_Impl::has(const uno::Any& aElement)
bool bHas = false;
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
TModelList::iterator pIt = impl_searchDoc(xDoc);
if (pIt != m_lModels.end())
bHas = true;
- aLock.clear();
// <- SAFE
return bHas;
@@ -253,14 +251,15 @@ void SAL_CALL SfxGlobalEvents_Impl::insert( const uno::Any& aElement )
0);
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
- TModelList::iterator pIt = impl_searchDoc(xDoc);
- if (pIt != m_lModels.end())
- throw container::ElementExistException(
+ {
+ osl::MutexGuard aLock(m_aLock);
+ TModelList::iterator pIt = impl_searchDoc(xDoc);
+ if (pIt != m_lModels.end())
+ throw container::ElementExistException(
OUString(),
- static_cast< container::XSet* >(this));
- m_lModels.push_back(xDoc);
- aLock.clear();
+ static_cast<container::XSet*>(this));
+ m_lModels.push_back(xDoc);
+ }
// <- SAFE
uno::Reference< document::XDocumentEventBroadcaster > xDocBroadcaster(xDoc, uno::UNO_QUERY );
@@ -287,14 +286,15 @@ void SAL_CALL SfxGlobalEvents_Impl::remove( const uno::Any& aElement )
0);
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
- TModelList::iterator pIt = impl_searchDoc(xDoc);
- if (pIt == m_lModels.end())
- throw container::NoSuchElementException(
+ {
+ osl::MutexGuard aLock(m_aLock);
+ TModelList::iterator pIt = impl_searchDoc(xDoc);
+ if (pIt == m_lModels.end())
+ throw container::NoSuchElementException(
OUString(),
- static_cast< container::XSet* >(this));
- m_lModels.erase(pIt);
- aLock.clear();
+ static_cast<container::XSet*>(this));
+ m_lModels.erase(pIt);
+ }
// <- SAFE
uno::Reference< document::XDocumentEventBroadcaster > xDocBroadcaster(xDoc, uno::UNO_QUERY );
@@ -313,14 +313,13 @@ void SAL_CALL SfxGlobalEvents_Impl::remove( const uno::Any& aElement )
uno::Reference< container::XEnumeration > SAL_CALL SfxGlobalEvents_Impl::createEnumeration()
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
uno::Sequence<uno::Any> models(m_lModels.size());
for (size_t i = 0; i < m_lModels.size(); ++i)
{
models[i] <<= m_lModels[i];
}
uno::Reference<container::XEnumeration> xEnum(new ::comphelper::OAnyEnumeration(models));
- aLock.clear();
// <- SAFE
return xEnum;
@@ -336,7 +335,7 @@ uno::Type SAL_CALL SfxGlobalEvents_Impl::getElementType()
sal_Bool SAL_CALL SfxGlobalEvents_Impl::hasElements()
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::MutexGuard aLock(m_aLock);
return (!m_lModels.empty());
// <- SAFE
}
@@ -360,7 +359,7 @@ void SfxGlobalEvents_Impl::implts_checkAndExecuteEventBindings(const document::D
try
{
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ osl::ClearableMutexGuard aLock(m_aLock);
uno::Reference< container::XNameReplace > xEvents = m_xEvents;
aLock.clear();
// <- SAFE