diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-14 13:32:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-15 18:15:18 +0200 |
commit | 1a253362f6d1e1909913dce298630c92d431e41e (patch) | |
tree | f97468cd564328fffab6870a82a7326bddf70809 /drawinglayer/source | |
parent | c7dfec21b44b23c4e52b938721f356f75046f37b (diff) |
speed up startup time
by avoid conversion of static locale data from sal_Unicode to OUString
data - we can declare the data as OUStringConstExpr arrays and then
no conversion is necessary.
Here we trigger a problem - EditDLL has static data that tends
to get torn down __after__ the i18npool shared library has been
removed from memory, which means it tries to access OUStringLiteral
objects that no longer exists.
So use vcl::DeleteOnExit to explicitly clear that on application
shutdown.
Change-Id: Ie4bfcef7eb4656316ea825474ac42f85844d1dcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153060
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 20 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx | 3 |
2 files changed, 13 insertions, 10 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 1b411d16f443..794f8085f9c8 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -520,7 +520,8 @@ void VclMetafileProcessor2D::popList() } // init static break iterator -uno::Reference<css::i18n::XBreakIterator> VclMetafileProcessor2D::mxBreakIterator; +vcl::DeleteOnDeinit<uno::Reference<css::i18n::XBreakIterator>> + VclMetafileProcessor2D::mxBreakIterator; VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) @@ -1470,12 +1471,13 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( // #i101169# if(pTextDecoratedCandidate) { // support for TEXT_ MetaFile actions only for decorated texts - if (!mxBreakIterator.is()) + if (!mxBreakIterator.get() || !mxBreakIterator.get()->get()) { uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext()); - mxBreakIterator = i18n::BreakIterator::create(xContext); + mxBreakIterator.set(i18n::BreakIterator::create(xContext)); } + auto& rBreakIterator = *mxBreakIterator.get()->get(); const OUString& rTxt = rTextCandidate.getText(); const sal_Int32 nTextLength(rTextCandidate.getTextLength()); // rTxt.getLength()); @@ -1486,13 +1488,13 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( const sal_Int32 nTextPosition(rTextCandidate.getTextPosition()); sal_Int32 nDone; - sal_Int32 nNextCellBreak(mxBreakIterator->nextCharacters( + sal_Int32 nNextCellBreak(rBreakIterator.nextCharacters( rTxt, nTextPosition, rLocale, css::i18n::CharacterIteratorMode::SKIPCELL, 0, nDone)); - css::i18n::Boundary nNextWordBoundary(mxBreakIterator->getWordBoundary( + css::i18n::Boundary nNextWordBoundary(rBreakIterator.getWordBoundary( rTxt, nTextPosition, rLocale, css::i18n::WordType::ANY_WORD, true)); sal_Int32 nNextSentenceBreak( - mxBreakIterator->endOfSentence(rTxt, nTextPosition, rLocale)); + rBreakIterator.endOfSentence(rTxt, nTextPosition, rLocale)); const OString aCommentStringA("XTEXT_EOC"); const OString aCommentStringB("XTEXT_EOW"); const OString aCommentStringC("XTEXT_EOS"); @@ -1504,21 +1506,21 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( { mpMetaFile->AddAction( new MetaCommentAction(aCommentStringA, i - nTextPosition)); - nNextCellBreak = mxBreakIterator->nextCharacters( + nNextCellBreak = rBreakIterator.nextCharacters( rTxt, i, rLocale, css::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } if (i == nNextWordBoundary.endPos) { mpMetaFile->AddAction( new MetaCommentAction(aCommentStringB, i - nTextPosition)); - nNextWordBoundary = mxBreakIterator->getWordBoundary( + nNextWordBoundary = rBreakIterator.getWordBoundary( rTxt, i + 1, rLocale, css::i18n::WordType::ANY_WORD, true); } if (i == nNextSentenceBreak) { mpMetaFile->AddAction( new MetaCommentAction(aCommentStringC, i - nTextPosition)); - nNextSentenceBreak = mxBreakIterator->endOfSentence(rTxt, i + 1, rLocale); + nNextSentenceBreak = rBreakIterator.endOfSentence(rTxt, i + 1, rLocale); } } } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index 730b7aac11f2..c315281ebf61 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/i18n/XBreakIterator.hpp> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <vcl/pdfextoutdevdata.hxx> // vcl::PDFExtOutDevData support +#include <vcl/lazydelete.hxx> class GDIMetaFile; namespace tools @@ -175,7 +176,7 @@ private: constructed VclMetafileProcessor2D. It's still incarnated on demand, but exists for OOo runtime now by purpose. */ - static css::uno::Reference<css::i18n::XBreakIterator> mxBreakIterator; + static vcl::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>> mxBreakIterator; /* vcl::PDFExtOutDevData support For the first step, some extra actions at vcl::PDFExtOutDevData need to |