diff options
author | Ingrid Halama <iha@openoffice.org> | 2010-10-05 11:10:54 +0200 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2010-10-05 11:10:54 +0200 |
commit | f0a13fa4339ee940f267fb8787d6137b148abec9 (patch) | |
tree | dd8d95debf3d6306ffb4179f1b524f2abdc4d7da /chart2/source/model/template/CandleStickChartType.cxx | |
parent | 2e338e7a849f6302dcb427499772613c88822b6f (diff) |
chart49: #i113103# prevent deadlock caused by mixed mutex locking order wiht static variable initialization
Diffstat (limited to 'chart2/source/model/template/CandleStickChartType.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/model/template/CandleStickChartType.cxx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/chart2/source/model/template/CandleStickChartType.cxx b/chart2/source/model/template/CandleStickChartType.cxx index 22c8e058ea53..19c65522338c 100644..100755 --- a/chart2/source/model/template/CandleStickChartType.cxx +++ b/chart2/source/model/template/CandleStickChartType.cxx @@ -106,28 +106,31 @@ void lcl_AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW, true ); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticCandleStickChartTypeInfoHelper_Initializer { - static Sequence< Property > aPropSeq; + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); + return &aPropHelper; + } - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } - return aPropSeq; -} +}; + +struct StaticCandleStickChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticCandleStickChartTypeInfoHelper_Initializer > +{ +}; } // anonymous namespace @@ -284,10 +287,7 @@ uno::Any CandleStickChartType::GetDefaultValue( sal_Int32 nHandle ) const // ____ OPropertySet ____ ::cppu::IPropertyArrayHelper & SAL_CALL CandleStickChartType::getInfoHelper() { - static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - - return aArrayHelper; + return *StaticCandleStickChartTypeInfoHelper::get(); } |