summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configmgr/source/access.cxx94
-rw-r--r--configmgr/source/access.hxx2
-rw-r--r--configmgr/source/childaccess.cxx16
-rw-r--r--configmgr/source/childaccess.hxx1
-rw-r--r--configmgr/source/components.cxx11
-rw-r--r--configmgr/source/components.hxx1
-rw-r--r--configmgr/source/configurationprovider.cxx15
-rw-r--r--configmgr/source/defaultprovider.cxx2
-rw-r--r--configmgr/source/lock.cxx12
-rw-r--r--configmgr/source/lock.hxx3
-rw-r--r--configmgr/source/readonlyaccess.cxx2
-rw-r--r--configmgr/source/readwriteaccess.cxx2
-rw-r--r--configmgr/source/rootaccess.cxx17
-rw-r--r--configmgr/source/rootaccess.hxx2
-rw-r--r--configmgr/source/update.cxx10
15 files changed, 85 insertions, 105 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 9fe7f31cc00f..0564cb3bad88 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -171,7 +171,7 @@ void Access::initBroadcaster(
css::uno::Sequence< css::uno::Type > Access::getTypes()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
std::vector< css::uno::Type > types;
types.push_back(cppu::UnoType< css::uno::XInterface >::get());
@@ -222,7 +222,7 @@ css::uno::Sequence< css::uno::Type > Access::getTypes()
css::uno::Sequence< sal_Int8 > Access::getImplementationId()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return css::uno::Sequence< sal_Int8 >();
}
@@ -230,7 +230,7 @@ css::uno::Sequence< sal_Int8 > Access::getImplementationId()
OUString Access::getImplementationName()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return "org.openoffice-configmgr::Access";
}
@@ -243,7 +243,7 @@ sal_Bool Access::supportsService(OUString const & ServiceName)
css::uno::Sequence< OUString > Access::getSupportedServiceNames()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
std::vector<OUString> services;
services.emplace_back("com.sun.star.configuration.ConfigurationAccess");
@@ -274,7 +274,7 @@ void Access::dispose() {
assert(thisIs(IS_ANY));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
if (getParentAccess().is()) {
throw css::uno::RuntimeException(
@@ -296,7 +296,7 @@ void Access::addEventListener(
{
assert(thisIs(IS_ANY));
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
if (!xListener.is()) {
throw css::uno::RuntimeException(
@@ -317,7 +317,7 @@ void Access::removeEventListener(
css::uno::Reference< css::lang::XEventListener > const & aListener)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
DisposeListeners::iterator i(disposeListeners_.find(aListener));
if (i != disposeListeners_.end()) {
@@ -327,7 +327,7 @@ void Access::removeEventListener(
css::uno::Type Access::getElementType() {
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
rtl::Reference< Node > p(getNode());
switch (p->kind()) {
@@ -350,7 +350,7 @@ css::uno::Type Access::getElementType() {
sal_Bool Access::hasElements() {
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return !getAllChildren().empty(); //TODO: optimize
}
@@ -394,7 +394,7 @@ bool Access::getByNameFast(const OUString & name, css::uno::Any & value)
css::uno::Any Access::getByName(OUString const & aName)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
css::uno::Any value;
if (!getByNameFast(aName, value))
@@ -406,7 +406,7 @@ css::uno::Any Access::getByName(OUString const & aName)
css::uno::Sequence< OUString > Access::getElementNames()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
std::vector<OUString> names;
@@ -421,7 +421,7 @@ css::uno::Sequence< OUString > Access::getElementNames()
sal_Bool Access::hasByName(OUString const & aName)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return getChild(aName).is();
}
@@ -429,7 +429,7 @@ sal_Bool Access::hasByName(OUString const & aName)
css::uno::Any Access::getByHierarchicalName(OUString const & aName)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
rtl::Reference< ChildAccess > child(getSubChild(aName));
if (!child.is()) {
@@ -442,7 +442,7 @@ css::uno::Any Access::getByHierarchicalName(OUString const & aName)
sal_Bool Access::hasByHierarchicalName(OUString const & aName)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return getSubChild(aName).is();
}
@@ -454,7 +454,7 @@ void Access::replaceByHierarchicalName(
assert(thisIs(IS_UPDATE));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
rtl::Reference< ChildAccess > child(getSubChild(aName));
if (!child.is()) {
@@ -494,7 +494,7 @@ void Access::addContainerListener(
{
assert(thisIs(IS_ANY));
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
if (!xListener.is()) {
throw css::uno::RuntimeException(
@@ -515,7 +515,7 @@ void Access::removeContainerListener(
css::uno::Reference< css::container::XContainerListener > const & xListener)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
ContainerListeners::iterator i(containerListeners_.find(xListener));
if (i != containerListeners_.end()) {
@@ -526,7 +526,7 @@ void Access::removeContainerListener(
OUString Access::getExactName(OUString const & aApproximateName)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return aApproximateName;
}
@@ -534,7 +534,7 @@ OUString Access::getExactName(OUString const & aApproximateName)
css::uno::Sequence< css::beans::Property > Access::getProperties()
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
std::vector< css::beans::Property > properties;
properties.reserve(children.size());
@@ -548,7 +548,7 @@ css::uno::Sequence< css::beans::Property > Access::getProperties()
css::beans::Property Access::getPropertyByName(OUString const & aName)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
rtl::Reference< ChildAccess > child(getChild(aName));
if (!child.is()) {
throw css::beans::UnknownPropertyException(
@@ -560,13 +560,13 @@ css::beans::Property Access::getPropertyByName(OUString const & aName)
sal_Bool Access::hasPropertyByName(OUString const & Name)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
return getChild(Name).is();
}
OUString Access::getHierarchicalName() {
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
// For backwards compatibility, return an absolute path representation where
// available:
@@ -588,7 +588,7 @@ OUString Access::composeHierarchicalName(
OUString const & aRelativeName)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
if (aRelativeName.isEmpty() || aRelativeName[0] == '/') {
throw css::lang::IllegalArgumentException(
@@ -605,7 +605,7 @@ OUString Access::composeHierarchicalName(
OUString Access::getName() {
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return getNameInternal();
}
@@ -615,7 +615,7 @@ void Access::setName(OUString const & aName)
assert(thisIs(IS_ANY));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
checkFinalized();
Modifications localMods;
@@ -681,7 +681,7 @@ void Access::setName(OUString const & aName)
css::beans::Property Access::getAsProperty()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return asProperty();
}
@@ -698,7 +698,7 @@ void Access::setPropertyValue(
assert(thisIs(IS_GROUP));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!getRootAccess()->isUpdate()) {
throw css::uno::RuntimeException(
"configmgr setPropertyValue on non-update access",
@@ -717,7 +717,7 @@ void Access::setPropertyValue(
css::uno::Any Access::getPropertyValue(OUString const & PropertyName)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
css::uno::Any value;
if (!getByNameFast(PropertyName, value))
@@ -733,7 +733,7 @@ void Access::addPropertyChangeListener(
{
assert(thisIs(IS_GROUP));
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!xListener.is()) {
throw css::uno::RuntimeException(
"null listener", static_cast< cppu::OWeakObject * >(this));
@@ -756,7 +756,7 @@ void Access::removePropertyChangeListener(
aListener)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkKnownProperty(aPropertyName);
PropertyChangeListeners::iterator i(
propertyChangeListeners_.find(aPropertyName));
@@ -778,7 +778,7 @@ void Access::addVetoableChangeListener(
{
assert(thisIs(IS_GROUP));
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!aListener.is()) {
throw css::uno::RuntimeException(
"null listener", static_cast< cppu::OWeakObject * >(this));
@@ -802,7 +802,7 @@ void Access::removeVetoableChangeListener(
aListener)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkKnownProperty(PropertyName);
VetoableChangeListeners::iterator i(
vetoableChangeListeners_.find(PropertyName));
@@ -824,7 +824,7 @@ void Access::setPropertyValues(
assert(thisIs(IS_GROUP));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!getRootAccess()->isUpdate()) {
throw css::uno::RuntimeException(
"configmgr setPropertyValues on non-update access",
@@ -853,7 +853,7 @@ css::uno::Sequence< css::uno::Any > Access::getPropertyValues(
css::uno::Sequence< OUString > const & aPropertyNames)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength());
for (sal_Int32 i = 0; i < aPropertyNames.getLength(); ++i)
@@ -874,7 +874,7 @@ void Access::addPropertiesChangeListener(
{
assert(thisIs(IS_GROUP));
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!xListener.is()) {
throw css::uno::RuntimeException(
"null listener", static_cast< cppu::OWeakObject * >(this));
@@ -895,7 +895,7 @@ void Access::removePropertiesChangeListener(
xListener)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
PropertiesChangeListeners::iterator i(
propertiesChangeListeners_.find(xListener));
if (i != propertiesChangeListeners_.end()) {
@@ -933,7 +933,7 @@ void Access::setHierarchicalPropertyValue(
assert(thisIs(IS_GROUP));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!getRootAccess()->isUpdate()) {
throw css::uno::RuntimeException(
"configmgr setHierarchicalPropertyName on non-update access",
@@ -958,7 +958,7 @@ css::uno::Any Access::getHierarchicalPropertyValue(
OUString const & aHierarchicalPropertyName)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalPropertyName));
if (!child.is()) {
throw css::beans::UnknownPropertyException(
@@ -975,7 +975,7 @@ void Access::setHierarchicalPropertyValues(
assert(thisIs(IS_GROUP));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (!getRootAccess()->isUpdate()) {
throw css::uno::RuntimeException(
"configmgr setPropertyValues on non-update access",
@@ -1009,7 +1009,7 @@ css::uno::Sequence< css::uno::Any > Access::getHierarchicalPropertyValues(
css::uno::Sequence< OUString > const & aHierarchicalPropertyNames)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
css::uno::Sequence< css::uno::Any > vals(
aHierarchicalPropertyNames.getLength());
for (sal_Int32 i = 0; i < aHierarchicalPropertyNames.getLength(); ++i) {
@@ -1030,7 +1030,7 @@ css::beans::Property Access::getPropertyByHierarchicalName(
OUString const & aHierarchicalName)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalName));
if (!child.is()) {
throw css::beans::UnknownPropertyException(
@@ -1043,7 +1043,7 @@ sal_Bool Access::hasPropertyByHierarchicalName(
OUString const & aHierarchicalName)
{
assert(thisIs(IS_GROUP));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
return getSubChild(aHierarchicalName).is();
}
@@ -1053,7 +1053,7 @@ void Access::replaceByName(
assert(thisIs(IS_UPDATE));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
rtl::Reference< ChildAccess > child(getChild(aName));
if (!child.is()) {
@@ -1093,7 +1093,7 @@ void Access::insertByName(
assert(thisIs(IS_EXTENSIBLE|IS_UPDATE));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
checkFinalized();
if (getChild(aName).is()) {
@@ -1152,7 +1152,7 @@ void Access::removeByName(OUString const & aName)
assert(thisIs(IS_EXTENSIBLE|IS_UPDATE));
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
rtl::Reference< ChildAccess > child(getChild(aName));
if (!child.is() || child->isFinalized() ||
@@ -1213,7 +1213,7 @@ css::uno::Reference< css::uno::XInterface > Access::createInstanceWithArguments(
}
Access::Access(Components & components):
- components_(components), disposed_(false), lock_( lock() )
+ components_(components), disposed_(false)
{
}
@@ -2193,7 +2193,7 @@ rtl::Reference< Access > Access::getNotificationRoot() {
#if !defined NDEBUG
bool Access::thisIs(int what) {
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
rtl::Reference< Node > p(getNode());
Node::Kind k(p->kind());
return (k != Node::KIND_PROPERTY && k != Node::KIND_LOCALIZED_VALUE &&
diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx
index d3cf9011a0ca..24f4ddadf665 100644
--- a/configmgr/source/access.hxx
+++ b/configmgr/source/access.hxx
@@ -436,8 +436,6 @@ private:
PropertiesChangeListeners propertiesChangeListeners_;
bool disposed_;
- std::shared_ptr<osl::Mutex> lock_;
-
#if !defined NDEBUG
protected:
enum {
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index 68bc0b01351c..65cb9fc2e53f 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -70,8 +70,7 @@ ChildAccess::ChildAccess(
rtl::Reference< Access > const & parent, OUString const & name,
rtl::Reference< Node > const & node):
Access(components), root_(root), parent_(parent), name_(name), node_(node),
- inTransaction_(false),
- lock_( lock() )
+ inTransaction_(false)
{
assert(root.is() && parent.is() && node.is());
}
@@ -79,8 +78,7 @@ ChildAccess::ChildAccess(
ChildAccess::ChildAccess(
Components & components, rtl::Reference< RootAccess > const & root,
rtl::Reference< Node > const & node):
- Access(components), root_(root), node_(node), inTransaction_(false),
- lock_( lock() )
+ Access(components), root_(root), node_(node), inTransaction_(false)
{
assert(root.is() && node.is());
}
@@ -148,7 +146,7 @@ void ChildAccess::release() throw () {
css::uno::Reference< css::uno::XInterface > ChildAccess::getParent()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return static_cast< cppu::OWeakObject * >(parent_.get());
}
@@ -156,7 +154,7 @@ css::uno::Reference< css::uno::XInterface > ChildAccess::getParent()
void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
throw css::lang::NoSupportException(
"setParent", static_cast< cppu::OWeakObject * >(this));
@@ -166,7 +164,7 @@ sal_Int64 ChildAccess::getSomething(
css::uno::Sequence< sal_Int8 > const & aIdentifier)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return aIdentifier == getTunnelId()
? reinterpret_cast< sal_Int64 >(this) : 0;
@@ -314,7 +312,7 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
}
ChildAccess::~ChildAccess() {
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (parent_.is()) {
parent_->releaseChild(name_);
}
@@ -339,7 +337,7 @@ void ChildAccess::addSupportedServiceNames(
css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
css::uno::Any res(Access::queryInterface(aType));
return res.hasValue()
diff --git a/configmgr/source/childaccess.hxx b/configmgr/source/childaccess.hxx
index 7a5a692d56a9..96f7f439f8c4 100644
--- a/configmgr/source/childaccess.hxx
+++ b/configmgr/source/childaccess.hxx
@@ -129,7 +129,6 @@ private:
std::unique_ptr< css::uno::Any > changedValue_;
bool inTransaction_;
// to determine if a free node can be inserted underneath some root
- std::shared_ptr<osl::Mutex> lock_;
};
}
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 939d226e964d..60b74f8d18f0 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -164,22 +164,20 @@ private:
OUString url_;
Data const & data_;
osl::Condition delay_;
- std::shared_ptr<osl::Mutex> lock_;
};
Components::WriteThread::WriteThread(
rtl::Reference< WriteThread > * reference, Components & components,
OUString const & url, Data const & data):
Thread("configmgrWriter"), reference_(reference), components_(components),
- url_(url), data_(data),
- lock_( lock() )
+ url_(url), data_(data)
{
assert(reference != nullptr);
}
void Components::WriteThread::execute() {
delay_.wait(std::chrono::seconds(1)); // must not throw; result_error is harmless and ignored
- osl::MutexGuard g(*lock_); // must not throw
+ osl::MutexGuard g(theConfigLock()); // must not throw
try {
try {
writeModFile(components_, url_, data_);
@@ -294,7 +292,7 @@ void Components::writeModifications() {
void Components::flushModifications() {
rtl::Reference< WriteThread > thread;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
thread = writeThread_;
}
if (thread.is()) {
@@ -461,7 +459,6 @@ Components::Components(
modificationTarget_(ModificationTarget::None)
{
assert(context.is());
- lock_ = lock();
OUString conf(expand("${CONFIGURATION_LAYERS}"));
int layer = 0;
for (sal_Int32 i = 0;;) {
@@ -622,7 +619,7 @@ Components::~Components()
if (bExitWasCalled)
{
// do not write, re-join threads
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (writeThread_.is())
{
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index dc64d3c995a3..f9e8ff0cd295 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -162,7 +162,6 @@ private:
int userExtensionLayer_;
ModificationTarget modificationTarget_;
OUString modificationFileUrl_;
- std::shared_ptr<osl::Mutex> lock_;
};
}
diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx
index aa9db3a394f0..65e785e2afe1 100644
--- a/configmgr/source/configurationprovider.cxx
+++ b/configmgr/source/configurationprovider.cxx
@@ -89,8 +89,7 @@ class Service:
public:
explicit Service(
const css::uno::Reference< css::uno::XComponentContext >& context):
- ServiceBase(m_aMutex), context_(context), default_(true),
- lock_( lock() )
+ ServiceBase(m_aMutex), context_(context), default_(true)
{
assert(context.is());
}
@@ -99,8 +98,7 @@ public:
const css::uno::Reference< css::uno::XComponentContext >& context,
OUString const & locale):
ServiceBase(m_aMutex), context_(context), locale_(locale),
- default_(false),
- lock_( lock() )
+ default_(false)
{
assert(context.is());
}
@@ -167,7 +165,6 @@ private:
css::uno::Reference< css::uno::XComponentContext > context_;
OUString locale_;
bool default_;
- std::shared_ptr<osl::Mutex> lock_;
};
css::uno::Reference< css::uno::XInterface > Service::createInstance(
@@ -253,7 +250,7 @@ Service::createInstanceWithArguments(
" service " + ServiceSpecifier),
static_cast< cppu::OWeakObject * >(this));
}
- osl::MutexGuard guard(*lock_);
+ osl::MutexGuard guard(theConfigLock());
Components & components = Components::getSingleton(context_);
rtl::Reference root(
new RootAccess(components, nodepath, locale, update));
@@ -324,12 +321,12 @@ void Service::removeFlushListener(
void Service::setLocale(css::lang::Locale const & eLocale)
{
- osl::MutexGuard guard(*lock_);
+ osl::MutexGuard guard(theConfigLock());
locale_ = LanguageTag::convertToBcp47( eLocale, false);
}
css::lang::Locale Service::getLocale() {
- osl::MutexGuard guard(*lock_);
+ osl::MutexGuard guard(theConfigLock());
css::lang::Locale loc;
if (! locale_.isEmpty()) {
loc = LanguageTag::convertToLocale( locale_, false);
@@ -340,7 +337,7 @@ css::lang::Locale Service::getLocale() {
void Service::flushModifications() const {
Components * components;
{
- osl::MutexGuard guard(*lock_);
+ osl::MutexGuard guard(theConfigLock());
components = &Components::getSingleton(context_);
}
components->flushModifications();
diff --git a/configmgr/source/defaultprovider.cxx b/configmgr/source/defaultprovider.cxx
index c456954bb332..d07aad8424c3 100644
--- a/configmgr/source/defaultprovider.cxx
+++ b/configmgr/source/defaultprovider.cxx
@@ -34,7 +34,7 @@ namespace configmgr { namespace default_provider {
css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
- osl::MutexGuard guard(*lock());
+ osl::MutexGuard guard(theConfigLock());
static css::uno::Reference< css::uno::XInterface > singleton(
configuration_provider::createDefault(context));
return singleton;
diff --git a/configmgr/source/lock.cxx b/configmgr/source/lock.cxx
index 3c0e25d432c5..7a30e409b8fa 100644
--- a/configmgr/source/lock.cxx
+++ b/configmgr/source/lock.cxx
@@ -19,17 +19,15 @@
#include <sal/config.h>
-#include <osl/mutex.hxx>
-
#include "lock.hxx"
namespace configmgr {
-std::shared_ptr<osl::Mutex> const & lock()
-{
- static std::shared_ptr<osl::Mutex> theLock(new osl::Mutex);
- return theLock;
-}
+ osl::Mutex& theConfigLock()
+ {
+ static osl::Mutex lock;
+ return lock;
+ }
}
diff --git a/configmgr/source/lock.hxx b/configmgr/source/lock.hxx
index ee98efcc365f..155c61e6f7fa 100644
--- a/configmgr/source/lock.hxx
+++ b/configmgr/source/lock.hxx
@@ -22,11 +22,10 @@
#include <sal/config.h>
#include <osl/mutex.hxx>
-#include <memory>
namespace configmgr {
-std::shared_ptr<osl::Mutex> const & lock();
+ osl::Mutex& theConfigLock();
}
diff --git a/configmgr/source/readonlyaccess.cxx b/configmgr/source/readonlyaccess.cxx
index 079459dc747f..f8ee113eadf2 100644
--- a/configmgr/source/readonlyaccess.cxx
+++ b/configmgr/source/readonlyaccess.cxx
@@ -93,7 +93,7 @@ void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments)
throw css::uno::RuntimeException(
"already initialized", static_cast< cppu::OWeakObject * >(this));
}
- osl::MutexGuard g2(*lock());
+ osl::MutexGuard g2(theConfigLock());
Components & components = Components::getSingleton(context_);
root_ = new RootAccess(components, "/", locale, false);
components.addRootAccess(root_);
diff --git a/configmgr/source/readwriteaccess.cxx b/configmgr/source/readwriteaccess.cxx
index 3cbf006c8ad4..57b1612ac89b 100644
--- a/configmgr/source/readwriteaccess.cxx
+++ b/configmgr/source/readwriteaccess.cxx
@@ -115,7 +115,7 @@ void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments)
throw css::uno::RuntimeException(
"already initialized", static_cast< cppu::OWeakObject * >(this));
}
- osl::MutexGuard g2(*lock());
+ osl::MutexGuard g2(theConfigLock());
Components & components = Components::getSingleton(context_);
root_ = new RootAccess(components, "/", locale, true);
components.addRootAccess(root_);
diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx
index 17c9f111a27a..f3ab2eed49e4 100644
--- a/configmgr/source/rootaccess.cxx
+++ b/configmgr/source/rootaccess.cxx
@@ -58,7 +58,6 @@ RootAccess::RootAccess(
OUString const & locale, bool update):
Access(components), pathRepresentation_(pathRepresentation),
locale_(locale),
- lock_( lock() ),
update_(update), finalized_(false), alive_(true)
{
}
@@ -112,7 +111,7 @@ void RootAccess::addChangesListener(
{
assert(thisIs(IS_ANY));
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
if (!aListener.is()) {
throw css::uno::RuntimeException(
@@ -133,7 +132,7 @@ void RootAccess::removeChangesListener(
css::uno::Reference< css::util::XChangesListener > const & aListener)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
ChangesListeners::iterator i(changesListeners_.find(aListener));
if (i != changesListeners_.end()) {
@@ -150,7 +149,7 @@ void RootAccess::commitChanges()
}
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
int finalizedLayer;
@@ -169,7 +168,7 @@ void RootAccess::commitChanges()
sal_Bool RootAccess::hasPendingChanges() {
assert(thisIs(IS_UPDATE));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
//TODO: Optimize:
std::vector< css::util::ElementChange > changes;
@@ -180,7 +179,7 @@ sal_Bool RootAccess::hasPendingChanges() {
css::uno::Sequence< ::css::util::ElementChange > RootAccess::getPendingChanges()
{
assert(thisIs(IS_UPDATE));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
std::vector< css::util::ElementChange > changes;
reportChildChanges(&changes);
@@ -189,7 +188,7 @@ css::uno::Sequence< ::css::util::ElementChange > RootAccess::getPendingChanges()
RootAccess::~RootAccess()
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
if (alive_)
getComponents().removeRootAccess(this);
}
@@ -280,7 +279,7 @@ void RootAccess::clearListeners() throw() {
css::uno::Any RootAccess::queryInterface(css::uno::Type const & aType)
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
css::uno::Any res(Access::queryInterface(aType));
if (res.hasValue()) {
@@ -301,7 +300,7 @@ css::uno::Any RootAccess::queryInterface(css::uno::Type const & aType)
OUString RootAccess::getImplementationName()
{
assert(thisIs(IS_ANY));
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
checkLocalizedPropertyAccess();
return "configmgr.RootAccess";
}
diff --git a/configmgr/source/rootaccess.hxx b/configmgr/source/rootaccess.hxx
index 042c2afeaaf4..8157f8e6c7a2 100644
--- a/configmgr/source/rootaccess.hxx
+++ b/configmgr/source/rootaccess.hxx
@@ -134,8 +134,6 @@ private:
OUString name_;
ChangesListeners changesListeners_;
- std::shared_ptr<osl::Mutex> lock_;
-
bool update_:1;
bool finalized_:1;
bool alive_:1;
diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx
index 046fea4b0285..983c2e88fac2 100644
--- a/configmgr/source/update.cxx
+++ b/configmgr/source/update.cxx
@@ -59,7 +59,6 @@ public:
context_(context)
{
assert(context.is());
- lock_ = lock();
}
private:
@@ -81,14 +80,13 @@ private:
css::uno::Sequence< OUString > const & includedPaths,
css::uno::Sequence< OUString > const & excludedPaths) override;
- std::shared_ptr<osl::Mutex> lock_;
css::uno::Reference< css::uno::XComponentContext > context_;
};
void Service::insertExtensionXcsFile(
sal_Bool shared, OUString const & fileUri)
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
Components::getSingleton(context_).insertExtensionXcsFile(shared, fileUri);
}
@@ -97,7 +95,7 @@ void Service::insertExtensionXcuFile(
{
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
Components & components = Components::getSingleton(context_);
Modifications mods;
components.insertExtensionXcuFile(shared, fileUri, &mods);
@@ -111,7 +109,7 @@ void Service::removeExtensionXcuFile(OUString const & fileUri)
{
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
Components & components = Components::getSingleton(context_);
Modifications mods;
components.removeExtensionXcuFile(fileUri, &mods);
@@ -128,7 +126,7 @@ void Service::insertModificationXcuFile(
{
Broadcaster bc;
{
- osl::MutexGuard g(*lock_);
+ osl::MutexGuard g(theConfigLock());
Components & components = Components::getSingleton(context_);
Modifications mods;
components.insertModificationXcuFile(