summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-24 19:40:35 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-25 09:22:55 +0200
commitf0c49bd1554885ed601ae9a9507a5689b2cc7914 (patch)
treeaa8db91ede97c2f4e1c72515d27abddea9c86783
parent8bcdd32f2fbb8825564ec4eeabe1d6f3eed808ce (diff)
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
-rw-r--r--connectivity/source/parse/sqlbison.y1
-rw-r--r--connectivity/source/parse/sqlnode.cxx12
-rw-r--r--desktop/source/lib/lokclipboard.cxx9
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx18
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx7
-rw-r--r--include/connectivity/sqlparse.hxx2
-rw-r--r--sw/inc/viewsh.hxx4
-rw-r--r--sw/source/core/txtnode/fntcache.cxx2
-rw-r--r--sw/source/core/view/viewsh.cxx16
9 files changed, 49 insertions, 22 deletions
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index e9cd110c0f02..849f925d7637 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -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)
{
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 89d3d30779e6..bccdb37a947b 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -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()
{
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 99f803523d40..c64a9ecd9cb2 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -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();
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 45be8e0cc47e..5d8c73b9d028 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -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());
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
index daad6d6e8dae..07e81b360cec 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
@@ -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
diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx
index 43336b9628fb..790da073aad5 100644
--- a/include/connectivity/sqlparse.hxx
+++ b/include/connectivity/sqlparse.hxx
@@ -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);
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index f453cc375f1d..1752a167d149 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -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; }
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index c0ae4b639d81..3ae9456e62d8 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -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();
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index a1bc4407f664..dccebd31546f 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -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;