cid#1633781 Initialization or destruction ordering is unspecified

and

cid#1633780 Initialization or destruction ordering is unspecified
cid#1633778 Initialization or destruction ordering is unspecified
cid#1633777 Initialization or destruction ordering is unspecified
cid#1633776 Initialization or destruction ordering is unspecified

Change-Id: I8ae7cbede6df2ad747fe57d0ac2800e1b6a31038
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175576
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara 2024-10-24 19:40:35 +01:00
parent 8bcdd32f2f
commit f0c49bd155
9 changed files with 49 additions and 22 deletions

View file

@ -4505,7 +4505,6 @@ sal_Int32 OSQLParser::s_nRefCount = 0;
// ::osl::Mutex OSQLParser::s_aMutex;
OSQLScanner* OSQLParser::s_pScanner = nullptr;
OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = nullptr;
tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> OSQLParser::s_xLocaleData(tools::DeleteOnDeinitFlag::Empty);
void setParser(OSQLParser* _pParser)
{

View file

@ -803,6 +803,7 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral)
{
if ( pLiteral )
{
auto& s_xLocaleData = getLocaleData();
if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
{
pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace('.', sal_Unicode());
@ -1118,6 +1119,7 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale)
OUString aValue;
if(!m_xCharClass.is())
m_xCharClass = CharacterClassification::create( m_xContext );
auto& s_xLocaleData = getLocaleData();
if( s_xLocaleData.get() )
{
try
@ -1248,10 +1250,13 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
s_pScanner->SetRule(OSQLScanner::GetSTRINGRule());
break;
default:
{
auto& s_xLocaleData = getLocaleData();
if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' )
s_pScanner->SetRule(OSQLScanner::GetGERRule());
else
s_pScanner->SetRule(OSQLScanner::GetENGRule());
}
}
}
@ -1334,6 +1339,7 @@ OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xConte
s_pScanner->setScanner();
s_pGarbageCollector = new OSQLParseNodesGarbageCollector();
auto& s_xLocaleData = getLocaleData();
if(!s_xLocaleData.get())
s_xLocaleData.set(LocaleData::create(m_xContext));
@ -1473,6 +1479,12 @@ OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xConte
m_pData->aLocale = m_pContext->getPreferredLocale();
}
//static
tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>>& OSQLParser::getLocaleData()
{
static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData(tools::DeleteOnDeinitFlag::Empty);
return s_xLocaleData;
}
OSQLParser::~OSQLParser()
{

View file

@ -20,7 +20,12 @@ using namespace css;
using namespace css::uno;
/* static */ osl::Mutex LOKClipboardFactory::gMutex;
static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>> gClipboards{};
static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>>& getClipboards()
{
static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>>
gClipboards{};
return gClipboards;
}
rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
{
@ -28,6 +33,7 @@ rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
osl::MutexGuard aGuard(gMutex);
auto& gClipboards = getClipboards();
auto it = gClipboards.get()->find(nViewId);
if (it != gClipboards.get()->end())
{
@ -44,6 +50,7 @@ void LOKClipboardFactory::releaseClipboardForView(int nViewId)
{
osl::MutexGuard aGuard(gMutex);
auto& gClipboards = getClipboards();
if (nViewId < 0) // clear all
{
gClipboards.get()->clear();

View file

@ -521,10 +521,6 @@ void VclMetafileProcessor2D::popList()
popStructureElement(vcl::PDFWriter::List);
}
// init static break iterator
tools::DeleteOnDeinit<uno::Reference<css::i18n::XBreakIterator>>
VclMetafileProcessor2D::mxBreakIterator;
VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation,
OutputDevice& rOutDev)
: VclProcessor2D(rViewInformation, rOutDev)
@ -1495,14 +1491,22 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D(
// #i101169# if(pTextDecoratedCandidate)
{
/* break iterator support
made static so it only needs to be fetched once, even with many single
constructed VclMetafileProcessor2D. It's still incarnated on demand,
but exists for OOo runtime now by purpose.
*/
static tools::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>>
gxBreakIterator;
// support for TEXT_ MetaFile actions only for decorated texts
if (!mxBreakIterator.get() || !mxBreakIterator.get()->get())
if (!gxBreakIterator.get() || !gxBreakIterator.get()->get())
{
uno::Reference<uno::XComponentContext> xContext(
::comphelper::getProcessComponentContext());
mxBreakIterator.set(i18n::BreakIterator::create(xContext));
gxBreakIterator.set(i18n::BreakIterator::create(xContext));
}
auto& rBreakIterator = *mxBreakIterator.get()->get();
auto& rBreakIterator = *gxBreakIterator.get()->get();
const OUString& rTxt = rTextCandidate.getText();
const sal_Int32 nTextLength(rTextCandidate.getTextLength()); // rTxt.getLength());

View file

@ -171,13 +171,6 @@ private:
*/
double mfCurrentUnifiedTransparence;
/* break iterator support
made static so it only needs to be fetched once, even with many single
constructed VclMetafileProcessor2D. It's still incarnated on demand,
but exists for OOo runtime now by purpose.
*/
static tools::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>> mxBreakIterator;
/* vcl::PDFExtOutDevData support
For the first step, some extra actions at vcl::PDFExtOutDevData need to
be emulated with the VclMetafileProcessor2D. These are potentially temporarily

View file

@ -140,7 +140,7 @@ namespace connectivity
sal_Int32 m_nDateFormatKey;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::i18n::XCharacterClassification> m_xCharClass;
static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData;
static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>>& getLocaleData();
// convert a string into double trim it to scale of _nscale and then transform it back to string
OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale);

View file

@ -193,7 +193,6 @@ class SAL_DLLPUBLIC_RTTI SwViewShell : public sw::Ring<SwViewShell>
protected:
static ShellResource* spShellRes; ///< Resources for the Shell.
static tools::DeleteOnDeinit< std::shared_ptr<weld::Window> > spCareDialog; ///< Avoid this window.
SwRect maVisArea; ///< The modern version of VisArea.
tools::Rectangle maLOKVisibleArea;///< The visible area in the LibreOfficeKit client.
@ -477,8 +476,7 @@ public:
static weld::Window* CareChildWin(SwViewShell const & rVSh);
SW_DLLPUBLIC static void SetCareDialog(const std::shared_ptr<weld::Window>& rNew);
static weld::Window* GetCareDialog(SwViewShell const & rVSh)
{ return (*spCareDialog.get()) ? spCareDialog.get()->get() : CareChildWin(rVSh); }
static weld::Window* GetCareDialog(SwViewShell const & rVSh);
SfxViewShell *GetSfxViewShell() const { return mpSfxViewShell; }
void SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; }

View file

@ -72,7 +72,6 @@ constexpr Color gWaveCol(COL_GRAY);
tools::Long SwFntObj::s_nPixWidth;
MapMode* SwFntObj::s_pPixMap = nullptr;
static tools::DeleteOnDeinit< VclPtr<OutputDevice> > s_pFntObjPixOut {};
void SwFntCache::Flush( )
{
@ -992,6 +991,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
Point aTextOriginPos( rInf.GetPos() );
if( !bPrt )
{
static tools::DeleteOnDeinit< VclPtr<OutputDevice> > s_pFntObjPixOut {};
if( rInf.GetpOut() != *s_pFntObjPixOut.get() || rInf.GetOut().GetMapMode() != *s_pPixMap )
{
*s_pPixMap = rInf.GetOut().GetMapMode();

View file

@ -89,7 +89,12 @@
bool SwViewShell::sbLstAct = false;
ShellResource *SwViewShell::spShellRes = nullptr;
tools::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::spCareDialog {};
static tools::DeleteOnDeinit<std::shared_ptr<weld::Window>>& getCareDialog()
{
static tools::DeleteOnDeinit<std::shared_ptr<weld::Window>> spCareDialog {}; ///< Avoid this window.
return spCareDialog;
}
static bool bInSizeNotify = false;
@ -2731,11 +2736,20 @@ ShellResource* SwViewShell::GetShellRes()
return spShellRes;
}
//static
void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
{
auto& spCareDialog = getCareDialog();
(*spCareDialog.get()) = rNew;
}
//static
weld::Window* SwViewShell::GetCareDialog(SwViewShell const & rVSh)
{
auto& spCareDialog = getCareDialog();
return (*spCareDialog.get()) ? spCareDialog.get()->get() : CareChildWin(rVSh);
}
sal_uInt16 SwViewShell::GetPageCount() const
{
return GetLayout() ? GetLayout()->GetPageNum() : 1;