summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-12-27 16:25:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-12-27 17:23:17 +0000
commit1b9ca3689dab4deaea20be511eb942674bbbc481 (patch)
tree611cf6c5807f1b792fd0c55df6bc19364a77c873 /include
parent63dcb9b5ee055f3812c86c3b0553426db524c906 (diff)
try to fix shutdown crashes in ConfigurationWrapper
associated with commit 7df433cdc33b4d6ba38eafad9282d015571433ef optimize ConfigurationProperty::get() it seems it introduced https://crashreport.libreoffice.org/stats/signature/void%20rtl::str::release%3C_rtl_uString%3E(_rtl_uString*) which, at the moment, is the most reported crash in https://crashreport.libreoffice.org/stats/version/7.4.3.2 We need to tie the lifetime of ConfigurationWrapper and the cache objects together, so they die as one unit, otherwise the unpredicatable ordering of destruction of static objects is a problem. Change-Id: I80db5a4c28510a68f40b919902b01f3981e32bfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/configuration.hxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx
index 3b8f8f1f7e93..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,8 +85,11 @@ private:
namespace detail {
+class ConfigurationChangesListener;
+
/// @internal
class COMPHELPER_DLLPUBLIC ConfigurationWrapper {
+friend class ConfigurationChangesListener;
public:
static ConfigurationWrapper const & get();
@@ -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