sw/inc/ndtxt.hxx | 2 +- sw/source/core/txtnode/ndtxt.cxx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
New commits: commit d21a1d999f8872f22a96ad7d1dc2f0e3b48421b5 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Sep 22 21:04:22 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 24 08:38:54 2021 +0200 no need to allocate this OUString on the heap Change-Id: Iea9afe291e9dbf964bf1577818ce1a44058eb943 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122538 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index ad6a3c4ac27e..6b64fdef8b19 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -117,7 +117,7 @@ class SW_DLLPUBLIC SwTextNode final Needed to avoid duplicate handling of attribute change actions. */ bool mbInSetOrResetAttr; - std::unique_ptr< OUString > m_pNumStringCache; + std::optional< OUString > m_oNumStringCache; css::uno::WeakReference<css::text::XTextContent> m_wXParagraph; diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 190b39a5a7fa..05548bb3e69b 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1971,9 +1971,9 @@ void SwTextNode::CopyText( SwTextNode *const pDest, if (pDest->GetDoc().IsClipBoard() && GetNum()) { // #i111677# cache expansion of source (for clipboard) - pDest->m_pNumStringCache.reset( (nTextStartIdx != 0) - ? new OUString // fdo#49076: numbering only if copy from para start - : new OUString(GetNumString())); + pDest->m_oNumStringCache = (nTextStartIdx != 0) + ? OUString() // fdo#49076: numbering only if copy from para start + : GetNumString(); } if( !nLen ) @@ -3086,10 +3086,10 @@ OUString SwTextNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, const unsigned int _nRestrictToThisLevel, SwRootFrame const*const pLayout) const { - if (GetDoc().IsClipBoard() && m_pNumStringCache) + if (GetDoc().IsClipBoard() && m_oNumStringCache) { // #i111677# do not expand number strings in clipboard documents - return *m_pNumStringCache; + return *m_oNumStringCache; } const SwNumRule* pRule = GetNum(pLayout) ? GetNum(pLayout)->GetNumRule() : nullptr; if ( pRule &&