diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 11:43:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 11:35:24 +0000 |
commit | a2e78d06df22e99f2dc82ee3245ddc4c5de56acf (patch) | |
tree | eb4b9befec3e327718d29b233a6453aa9a2aeb34 /chart2/source/model/main | |
parent | 167b864fb1933d069293760e50e1f204a3d2e63d (diff) |
fix concurrent access to fontcache
Every now and then I see a crash in fontcache code.
Add some DBG_SOLARMUTEX calls there, which spots a few issues.
(*) In writer, SwDLL needs to be under the SolarMutex during
init, and we can just move a method call to fix that.
(*) in chart2, life is more complicated. Various of the static
defaults we build want to call OutputDevice::getFontInstance.
We can't just stick a SolarMutex somewhere in the call chain,
because those maps are built on-demand, and then we end up
with ABBA deadlocks between the SolarMutex and the mutex
in the cppu::PropertySetHelper.
So I picked a spot that is init'ed early on in chart2,
and force the init of all the troublesome tables there.
Change-Id: I832978bea35fd5fa681d144b8beff1af13ef3341
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149648
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/model/main')
-rw-r--r-- | chart2/source/model/main/Axis.cxx | 6 | ||||
-rw-r--r-- | chart2/source/model/main/DataSeries.cxx | 7 | ||||
-rw-r--r-- | chart2/source/model/main/FormattedString.cxx | 15 | ||||
-rw-r--r-- | chart2/source/model/main/Legend.cxx | 7 |
4 files changed, 29 insertions, 6 deletions
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 6ee948968369..99e20fbc86fb 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -205,7 +205,10 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEVOID ); } +} // namespace +namespace chart +{ const ::chart::tPropertyValueMap & StaticAxisDefaults() { static ::chart::tPropertyValueMap aStaticDefaults = []() @@ -239,7 +242,10 @@ const ::chart::tPropertyValueMap & StaticAxisDefaults() }(); return aStaticDefaults; }; +} // namespace chart +namespace +{ ::cppu::OPropertyArrayHelper& StaticAxisInfoHelper() { static ::cppu::OPropertyArrayHelper aPropHelper = []() diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx index 6d224d6a39de..9f863f888dd0 100644 --- a/chart2/source/model/main/DataSeries.cxx +++ b/chart2/source/model/main/DataSeries.cxx @@ -46,9 +46,8 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; using ::osl::MutexGuard; -namespace +namespace chart { - const ::chart::tPropertyValueMap & StaticDataSeriesDefaults() { static const ::chart::tPropertyValueMap aStaticDefaults = []() @@ -64,6 +63,10 @@ const ::chart::tPropertyValueMap & StaticDataSeriesDefaults() }(); return aStaticDefaults; }; +} // namespace chart + +namespace +{ ::cppu::OPropertyArrayHelper& StaticDataSeriesInfoHelper() { diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx index 5da70943ded5..dbd5876b978a 100644 --- a/chart2/source/model/main/FormattedString.cxx +++ b/chart2/source/model/main/FormattedString.cxx @@ -32,15 +32,22 @@ using ::com::sun::star::beans::Property; using ::com::sun::star::uno::Sequence; using ::osl::MutexGuard; -namespace +namespace chart { - const ::chart::tPropertyValueMap & StaticFormattedStringDefaults() { - static ::chart::tPropertyValueMap aStaticDefaults; - ::chart::CharacterProperties::AddDefaultsToMap( aStaticDefaults ); + static ::chart::tPropertyValueMap aStaticDefaults = [] + { + ::chart::tPropertyValueMap aMap; + ::chart::CharacterProperties::AddDefaultsToMap( aMap ); + return aMap; + }(); return aStaticDefaults; }; +} // namespace chart + +namespace +{ ::cppu::OPropertyArrayHelper& StaticFormattedStringInfoHelper() { diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index 9fc7cebd99ff..f72868b58cb5 100644 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -105,6 +105,10 @@ void lcl_AddPropertiesToVector( } +} // namespace + +namespace chart +{ const ::chart::tPropertyValueMap& StaticLegendDefaults() { static ::chart::tPropertyValueMap aStaticDefaults = []() @@ -127,7 +131,10 @@ const ::chart::tPropertyValueMap& StaticLegendDefaults() }(); return aStaticDefaults; }; +} // namespace chart +namespace +{ ::cppu::OPropertyArrayHelper& StaticLegendInfoHelper() { static ::cppu::OPropertyArrayHelper aPropHelper = []() |