diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-07 12:48:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-09 06:54:29 +0000 |
commit | 3a4a00a51acca8f9b5e775547abff0c4dc9144d7 (patch) | |
tree | a38ac9baec160268c1c3f36bb2fa1664de762cfb /include | |
parent | 81fa02eedbda2afa34c82420a02cd3b3f825be06 (diff) |
re-apply "optimize ConfigurationProperty::get()"
This reverts commit 05b2bfc289df8712097cc1e640bf7d3bc6b86a84,
but adds clearing of some more members, which were holding onto
references to bits of config data after the config service was
disposed.
Change-Id: I9969ee2472445e4e1dbe8ea15e081401845ad29c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146605
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/configuration.hxx | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx index 222b9d5af124..45228b700944 100644 --- a/include/comphelper/configuration.hxx +++ b/include/comphelper/configuration.hxx @@ -12,15 +12,16 @@ #include <sal/config.h> -#include <optional> -#include <string_view> - #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.h> #include <comphelper/comphelperdllapi.h> #include <comphelper/processfactory.hxx> #include <sal/types.h> #include <memory> +#include <mutex> +#include <optional> +#include <string_view> +#include <unordered_map> namespace com::sun::star { namespace configuration { class XReadWriteAccess; } @@ -31,6 +32,10 @@ namespace com::sun::star { class XNameContainer; } namespace uno { class XComponentContext; } + namespace util { + class XChangesListener; + class XChangesNotifier; + } } namespace comphelper { @@ -80,14 +85,17 @@ private: namespace detail { +class ConfigurationChangesListener; + /// @internal class COMPHELPER_DLLPUBLIC ConfigurationWrapper { +friend class ConfigurationChangesListener; public: static ConfigurationWrapper const & get(); bool isReadOnly(OUString const & path) const; - css::uno::Any getPropertyValue(std::u16string_view path) const; + css::uno::Any getPropertyValue(OUString const & path) const; static void setPropertyValue( std::shared_ptr< ConfigurationChanges > const & batch, @@ -135,6 +143,12 @@ private: // css.beans.XHierarchicalPropertySetInfo), but then // configmgr::Access::asProperty() would report all properties as // READONLY, so isReadOnly() would not work + + mutable std::mutex maMutex; + bool mbDisposed; + mutable std::unordered_map<OUString, css::uno::Any> maPropertyCache; + css::uno::Reference< css::util::XChangesNotifier > maNotifier; + css::uno::Reference< css::util::XChangesListener > maListener; }; /// @internal |