summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-10-09 11:26:38 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-10-09 14:52:05 +0000
commitc0096b5b8412a8bfd40b84491e6d6eccd6d98504 (patch)
tree26bdd4221d8cd35b53c90c72c336921b5f998b59 /comphelper
parentf76b3dd039818cc2b297fa2a11b60d9e055e6d8c (diff)
Hold the SolarMutex while updating properties; thanks to sberg.
Change-Id: Id9dc4c7e083da2a8d44c7295a8b605de81bca1ef Reviewed-on: https://gerrit.libreoffice.org/19272 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/configuration.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx
index e5bf8b84d2d2..ea01ceae43f0 100644
--- a/comphelper/source/misc/configuration.cxx
+++ b/comphelper/source/misc/configuration.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/solarmutex.hxx>
#include <comphelper/configuration.hxx>
#include <comphelper/configurationlistener.hxx>
#include <rtl/instance.hxx>
@@ -248,6 +249,12 @@ void SAL_CALL comphelper::ConfigurationListener::propertyChange(
css::beans::PropertyChangeEvent const &rEvt )
throw (css::uno::RuntimeException, std::exception)
{
+ // Code is commonly used inside the SolarMutexGuard
+ // so to avoid concurrent writes to the property,
+ // and allow fast, lock-less access, guard here.
+ rtl::Reference< comphelper::SolarMutex > xMutexGuard(
+ comphelper::SolarMutex::get() );
+
assert( rEvt.Source == mxConfig );
for ( auto it = maListeners.begin(); it != maListeners.end(); ++it )
{