diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-01-23 20:25:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-24 17:06:27 +0100 |
commit | 0310ae3049ba33ce07f48b1e0df2fbbcf2a87883 (patch) | |
tree | f205303f77d13b64dc25aed120c213d56bcb557f /comphelper | |
parent | 4656414b34408d3f127cb78b0ffc47f84754381b (diff) |
use osl::Guard instead of abusing rtl::Reference
to make this code easier to read
Change-Id: Ia1ea52cd713572be768f7b505080c08f15f6c542
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87290
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/configuration.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx index 9c26e1a08307..6c5b5c41dac3 100644 --- a/comphelper/source/misc/configuration.cxx +++ b/comphelper/source/misc/configuration.cxx @@ -244,8 +244,11 @@ void SAL_CALL comphelper::ConfigurationListener::propertyChange( // 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() ); + // + // Note that we are abusing rtl::Reference here to do acquire/release because, + // unlike osl::Guard, it is tolerant of null pointers, and on some code paths, the + // SolarMutex does not exist. + rtl::Reference<comphelper::SolarMutex> xMutexGuard( comphelper::SolarMutex::get() ); assert( rEvt.Source == mxConfig ); for (auto const& listener : maListeners) |