summaryrefslogtreecommitdiff
path: root/configmgr/source/components.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'configmgr/source/components.cxx')
-rw-r--r--configmgr/source/components.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 078de2cd3c3f..65bc00da9517 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -164,20 +164,22 @@ 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)
+ url_(url), data_(data),
+ lock_( lock() )
{
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(configmgr::GetLock()); // must not throw
+ osl::MutexGuard g(*lock_); // must not throw
try {
try {
writeModFile(components_, url_, data_);
@@ -293,7 +295,7 @@ void Components::writeModifications() {
void Components::flushModifications() {
rtl::Reference< WriteThread > thread;
{
- osl::MutexGuard g(configmgr::GetLock());
+ osl::MutexGuard g(*lock_);
thread = writeThread_;
}
if (thread.is()) {
@@ -461,6 +463,7 @@ Components::Components(
modificationTarget_(ModificationTarget::None)
{
assert(context.is());
+ lock_ = lock();
OUString conf(expand("${CONFIGURATION_LAYERS}"));
int layer = 0;
for (sal_Int32 i = 0;;) {
@@ -618,7 +621,7 @@ Components::~Components()
if (bExitWasCalled)
{
// do not write, re-join threads
- osl::MutexGuard g(configmgr::GetLock());
+ osl::MutexGuard g(*lock_);
if (writeThread_.is())
{