Kaydet (Commit) c0096b5b authored tarafından Michael Meeks's avatar Michael Meeks

Hold the SolarMutex while updating properties; thanks to sberg.

Change-Id: Id9dc4c7e083da2a8d44c7295a8b605de81bca1ef
Reviewed-on: https://gerrit.libreoffice.org/19272Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst f76b3dd0
......@@ -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 )
{
......
......@@ -37,6 +37,7 @@ public:
void dispose() { mxListener.clear(); }
};
/// Access to this class must be protected by the SolarMutex
template< typename uno_type > class ConfigurationListenerProperty : public ConfigurationListenerPropertyBase
{
uno_type maValue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment