diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-11-25 20:36:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-11-25 20:36:03 +0000 |
commit | 83ab35b7351ba42097efc9c2b04044038e50e4f7 (patch) | |
tree | 16d9cc994bb549167c182201897f142f53e25890 /configmgr/source/update.cxx | |
parent | Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/libs-core (diff) | |
download | core-83ab35b7351ba42097efc9c2b04044038e50e4f7.tar.gz core-83ab35b7351ba42097efc9c2b04044038e50e4f7.zip |
Resolves: fdo#31494# get ownership right
Ensure that the mutex lives as long as all its consumers. And
avoid launching threads if they have no work to do.
Diffstat (limited to 'configmgr/source/update.cxx')
-rw-r--r-- | configmgr/source/update.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 53eff2c2398e..7208eb3f8c69 100644 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -32,6 +32,7 @@ #include <set> #include "boost/noncopyable.hpp" +#include "boost/shared_ptr.hpp" #include "com/sun/star/configuration/XUpdate.hpp" #include "com/sun/star/lang/XSingleComponentFactory.hpp" #include "com/sun/star/uno/Any.hxx" @@ -77,7 +78,10 @@ class Service: private boost::noncopyable { public: - Service() {} + Service() + { + lock_ = lock(); + } private: virtual ~Service() {} @@ -98,13 +102,15 @@ private: css::uno::Sequence< rtl::OUString > const & includedPaths, css::uno::Sequence< rtl::OUString > const & excludedPaths) throw (css::uno::RuntimeException); + + boost::shared_ptr<osl::Mutex> lock_; }; void Service::insertExtensionXcsFile( sal_Bool shared, rtl::OUString const & fileUri) throw (css::uno::RuntimeException) { - osl::MutexGuard g(lock); + osl::MutexGuard g(*lock_); Components::getSingleton().insertExtensionXcsFile(shared, fileUri); } @@ -114,7 +120,7 @@ void Service::insertExtensionXcuFile( { Broadcaster bc; { - osl::MutexGuard g(lock); + osl::MutexGuard g(*lock_); Modifications mods; Components::getSingleton().insertExtensionXcuFile( shared, fileUri, &mods); @@ -129,7 +135,7 @@ void Service::removeExtensionXcuFile(rtl::OUString const & fileUri) { Broadcaster bc; { - osl::MutexGuard g(lock); + osl::MutexGuard g(*lock_); Modifications mods; Components::getSingleton().removeExtensionXcuFile(fileUri, &mods); Components::getSingleton().initGlobalBroadcaster( @@ -146,7 +152,7 @@ void Service::insertModificationXcuFile( { Broadcaster bc; { - osl::MutexGuard g(lock); + osl::MutexGuard g(*lock_); Modifications mods; Components::getSingleton().insertModificationXcuFile( fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods); |