Kaydet (Commit) 4ea1b80c authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Statics with non-trivial initialization must use StaticWithInit

...not StaticAggregate, as StaticAggregate does the initialization with
osl::GetGlobalMutex locked and can thus lead to deadlock.

Change-Id: I0cce0da84b5a277fdda1ebaaeba85b04011f5459
üst 994a3596
......@@ -43,41 +43,24 @@ using ::osl::MutexGuard;
namespace
{
struct StaticDataSeriesDefaults_Initializer
struct StaticDataSeriesDefaults : public rtl::StaticWithInit< ::chart::tPropertyValueMap, StaticDataSeriesDefaults >
{
::chart::tPropertyValueMap* operator()()
::chart::tPropertyValueMap operator()()
{
static ::chart::tPropertyValueMap aStaticDefaults;
lcl_AddDefaultsToMap( aStaticDefaults );
return &aStaticDefaults;
}
private:
void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
{
::chart::DataSeriesProperties::AddDefaultsToMap( rOutMap );
::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
::chart::tPropertyValueMap aStaticDefaults;
::chart::DataSeriesProperties::AddDefaultsToMap( aStaticDefaults );
::chart::CharacterProperties::AddDefaultsToMap( aStaticDefaults );
float fDefaultCharHeight = 10.0;
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
return aStaticDefaults;
}
};
struct StaticDataSeriesDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticDataSeriesDefaults_Initializer >
{
};
struct StaticDataSeriesInfoHelper_Initializer
struct StaticDataSeriesInfoHelper : public rtl::StaticWithInit< ::cppu::OPropertyArrayHelper, StaticDataSeriesInfoHelper, StaticDataSeriesInfoHelper, uno::Sequence< Property > >
{
::cppu::OPropertyArrayHelper* operator()()
{
static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
return &aPropHelper;
}
private:
uno::Sequence< Property > lcl_GetPropertySequence()
uno::Sequence< Property > operator()()
{
::std::vector< ::com::sun::star::beans::Property > aProperties;
::chart::DataSeriesProperties::AddPropertiesToVector( aProperties );
......@@ -89,27 +72,16 @@ private:
return ::chart::ContainerHelper::ContainerToSequence( aProperties );
}
};
struct StaticDataSeriesInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDataSeriesInfoHelper_Initializer >
{
};
struct StaticDataSeriesInfo_Initializer
struct StaticDataSeriesInfo : public rtl::StaticWithInit< uno::Reference< beans::XPropertySetInfo >, StaticDataSeriesInfo >
{
uno::Reference< beans::XPropertySetInfo >* operator()()
uno::Reference< beans::XPropertySetInfo > operator()()
{
static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDataSeriesInfoHelper::get() ) );
return &xPropertySetInfo;
return ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDataSeriesInfoHelper::get() );
}
};
struct StaticDataSeriesInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDataSeriesInfo_Initializer >
{
};
void lcl_SetParent(
const uno::Reference< uno::XInterface > & xChildInterface,
const uno::Reference< uno::XInterface > & xParentInterface )
......@@ -273,7 +245,7 @@ Sequence< OUString > DataSeries::getSupportedServiceNames_Static()
uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
const tPropertyValueMap& rStaticDefaults = *StaticDataSeriesDefaults::get();
const tPropertyValueMap& rStaticDefaults = StaticDataSeriesDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
return uno::Any();
......@@ -283,14 +255,14 @@ uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL DataSeries::getInfoHelper()
{
return *StaticDataSeriesInfoHelper::get();
return StaticDataSeriesInfoHelper::get();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL DataSeries::getPropertySetInfo()
throw (uno::RuntimeException, std::exception)
{
return *StaticDataSeriesInfo::get();
return StaticDataSeriesInfo::get();
}
void SAL_CALL DataSeries::getFastPropertyValue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment