From f0a13fa4339ee940f267fb8787d6137b148abec9 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Tue, 5 Oct 2010 11:10:54 +0200 Subject: chart49: #i113103# prevent deadlock caused by mixed mutex locking order wiht static variable initialization --- .../controller/chartapiwrapper/DiagramWrapper.cxx | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) mode change 100644 => 100755 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx (limited to 'chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx') diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx old mode 100644 new mode 100755 index eb3c76dd2c40..64571805a87f --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -434,15 +434,17 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticDiagramWrapperPropertyArray_Initializer { - static uno::Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + uno::Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); @@ -456,16 +458,16 @@ const uno::Sequence< Property > & lcl_GetPropertySequence() WrappedStockProperties::addProperties( aProperties ); WrappedAutomaticPositionProperties::addProperties( 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 StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer > +{ +}; bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram ) { @@ -2086,7 +2088,7 @@ Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet() const Sequence< beans::Property >& DiagramWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticDiagramWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties() -- cgit From 9f5af964256e4e6a98fc85b18e9dd477e012995e Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Wed, 6 Oct 2010 14:12:36 +0200 Subject: chart49: cleanup --- chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx') diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 64571805a87f..19e7d5b2dcd4 100755 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -572,7 +572,6 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) } typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap; -//static const tMakeStringStringMap& lcl_getChartTypeNameMap() { static tMakeStringStringMap g_aChartTypeNameMap = -- cgit