Kaydet (Commit) 49bbea41 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Static for static std::ordered_set in XMLPropStyleContext

we suspect the current situation of causing a crash on shutdown after
the tokenmap unit test:

(gdb) bt 20
__gnu_cxx::new_allocator<std::__detail::_Hash_node_base*>::deallocate
(this=0x7fffffff52c7, __p=0x78a700)
    at
/opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/ext/new_allocator.h:110
std::allocator<rtl::OUString>, std::__detail::_Identity,
std::equal_to<rtl::OUString>, rtl::OUStringHash,
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<true, true, true>
>::_M_deallocate_buckets (
    this=0x2aaab3166640 <XMLPropStyleContext::maParaSet>, __p=0x78a700,
__n=11) at
/opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/hashtable.h:794
std::allocator<rtl::OUString>, std::__detail::_Identity,
std::equal_to<rtl::OUString>, rtl::OUStringHash,
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<true, true, true> >::~_Hashtable (
    this=0x2aaab3166640 <XMLPropStyleContext::maParaSet>,
__in_chrg=<optimized out>) at
/opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/hashtable.h:959
rtl::OUStringHash, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString> >::~unordered_set (
    this=0x2aaab3166640 <XMLPropStyleContext::maParaSet>,
__in_chrg=<optimized out>) at
/opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/unordered_set.h:93
rtl::OUStringHash, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString> >::~unordered_set (
    this=0x2aaab3166640 <XMLPropStyleContext::maParaSet>,
__in_chrg=<optimized out>) at
/opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/debug/unordered_set:113

Change-Id: Iff36d4f217b8bb07083d2e599afade1f86206165
üst 6489bb3d
...@@ -48,12 +48,6 @@ private: ...@@ -48,12 +48,6 @@ private:
css::uno::Reference < css::style::XStyle > mxStyle; css::uno::Reference < css::style::XStyle > mxStyle;
SvXMLImportContextRef mxStyles; SvXMLImportContextRef mxStyles;
//UUUU
static OldFillStyleDefinitionSet maStandardSet;
static OldFillStyleDefinitionSet maHeaderSet;
static OldFillStyleDefinitionSet maFooterSet;
static OldFillStyleDefinitionSet maParaSet;
XMLPropStyleContext(XMLPropStyleContext &) = delete; XMLPropStyleContext(XMLPropStyleContext &) = delete;
void operator =(XMLPropStyleContext &) = delete; void operator =(XMLPropStyleContext &) = delete;
......
...@@ -71,11 +71,80 @@ void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey, ...@@ -71,11 +71,80 @@ void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
} }
//UUUU namespace
OldFillStyleDefinitionSet XMLPropStyleContext::maStandardSet; {
OldFillStyleDefinitionSet XMLPropStyleContext::maHeaderSet; struct theStandardSet :
OldFillStyleDefinitionSet XMLPropStyleContext::maFooterSet; public rtl::StaticWithInit<OldFillStyleDefinitionSet, theStandardSet>
OldFillStyleDefinitionSet XMLPropStyleContext::maParaSet; {
OldFillStyleDefinitionSet operator () ()
{
OldFillStyleDefinitionSet aSet;
aSet.insert("BackColorRGB");
aSet.insert("BackTransparent");
aSet.insert("BackColorTransparency");
aSet.insert("BackGraphicURL");
aSet.insert("BackGraphicFilter");
aSet.insert("BackGraphicLocation");
aSet.insert("BackGraphicTransparency");
return aSet;
}
};
struct theHeaderSet :
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theHeaderSet>
{
OldFillStyleDefinitionSet operator () ()
{
OldFillStyleDefinitionSet aSet;
aSet.insert("HeaderBackColorRGB");
aSet.insert("HeaderBackTransparent");
aSet.insert("HeaderBackColorTransparency");
aSet.insert("HeaderBackGraphicURL");
aSet.insert("HeaderBackGraphicFilter");
aSet.insert("HeaderBackGraphicLocation");
aSet.insert("HeaderBackGraphicTransparency");
return aSet;
}
};
struct theFooterSet :
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theFooterSet>
{
OldFillStyleDefinitionSet operator () ()
{
OldFillStyleDefinitionSet aSet;
aSet.insert("FooterBackColorRGB");
aSet.insert("FooterBackTransparent");
aSet.insert("FooterBackColorTransparency");
aSet.insert("FooterBackGraphicURL");
aSet.insert("FooterBackGraphicFilter");
aSet.insert("FooterBackGraphicLocation");
aSet.insert("FooterBackGraphicTransparency");
return aSet;
}
};
struct theParaSet :
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theParaSet>
{
OldFillStyleDefinitionSet operator () ()
{
OldFillStyleDefinitionSet aSet;
// Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
// 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
aSet.insert("ParaBackColor");
aSet.insert("ParaBackTransparent");
aSet.insert("ParaBackGraphicLocation");
aSet.insert("ParaBackGraphicFilter");
aSet.insert("ParaBackGraphicURL");
// These are not used in aXMLParaPropMap definition, thus not needed here
// aSet.insert("ParaBackColorTransparency");
// aSet.insert("ParaBackGraphicTransparency");
return aSet;
}
};
}
XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport, XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName, sal_uInt16 nPrfx, const OUString& rLName,
...@@ -95,70 +164,22 @@ XMLPropStyleContext::~XMLPropStyleContext() ...@@ -95,70 +164,22 @@ XMLPropStyleContext::~XMLPropStyleContext()
const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet() const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet()
{ {
if(maStandardSet.empty()) return theStandardSet::get();
{
maStandardSet.insert("BackColorRGB");
maStandardSet.insert("BackTransparent");
maStandardSet.insert("BackColorTransparency");
maStandardSet.insert("BackGraphicURL");
maStandardSet.insert("BackGraphicFilter");
maStandardSet.insert("BackGraphicLocation");
maStandardSet.insert("BackGraphicTransparency");
}
return maStandardSet;
} }
const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet() const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet()
{ {
if(maHeaderSet.empty()) return theHeaderSet::get();
{
maHeaderSet.insert("HeaderBackColorRGB");
maHeaderSet.insert("HeaderBackTransparent");
maHeaderSet.insert("HeaderBackColorTransparency");
maHeaderSet.insert("HeaderBackGraphicURL");
maHeaderSet.insert("HeaderBackGraphicFilter");
maHeaderSet.insert("HeaderBackGraphicLocation");
maHeaderSet.insert("HeaderBackGraphicTransparency");
}
return maHeaderSet;
} }
const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet() const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet()
{ {
if(maFooterSet.empty()) return theFooterSet::get();
{
maFooterSet.insert("FooterBackColorRGB");
maFooterSet.insert("FooterBackTransparent");
maFooterSet.insert("FooterBackColorTransparency");
maFooterSet.insert("FooterBackGraphicURL");
maFooterSet.insert("FooterBackGraphicFilter");
maFooterSet.insert("FooterBackGraphicLocation");
maFooterSet.insert("FooterBackGraphicTransparency");
}
return maFooterSet;
} }
const OldFillStyleDefinitionSet& XMLPropStyleContext::getParaSet() const OldFillStyleDefinitionSet& XMLPropStyleContext::getParaSet()
{ {
if(maParaSet.empty()) return theParaSet::get();
{
// Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
// 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
maParaSet.insert("ParaBackColor");
maParaSet.insert("ParaBackTransparent");
maParaSet.insert("ParaBackGraphicLocation");
maParaSet.insert("ParaBackGraphicFilter");
maParaSet.insert("ParaBackGraphicURL");
// These are not used in aXMLParaPropMap definition, thus not needed here
// maParaSet.insert("ParaBackColorTransparency");
// maParaSet.insert("ParaBackGraphicTransparency");
}
return maParaSet;
} }
SvXMLImportContext *XMLPropStyleContext::CreateChildContext( SvXMLImportContext *XMLPropStyleContext::CreateChildContext(
......
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