vcl/source/gdi/CommonSalLayout.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit e0c7d1e4cf7e6cf73211e69a91f458e6ffe303cb
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Sep 21 09:56:43 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Sep 21 12:20:51 2021 +0200

    stack allocate this TextLayoutCache object (tdf#125892
    
    Change-Id: I838543c47ec420ec3b562e0b7e8524c4b2f070a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122380
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 871bac2bf0f3..ad22c3415cc0 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -281,7 +281,7 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
     const int nLength = rArgs.mrStr.getLength();
     const sal_Unicode *pStr = rArgs.mrStr.getStr();
 
-    std::unique_ptr<vcl::text::TextLayoutCache> pNewScriptRun;
+    std::optional<vcl::text::TextLayoutCache> oNewScriptRun;
     vcl::text::TextLayoutCache const* pTextLayout;
     if (rArgs.m_pTextLayoutCache)
     {
@@ -289,8 +289,8 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
     }
     else
     {
-        pNewScriptRun.reset(new vcl::text::TextLayoutCache(pStr, 
rArgs.mnEndCharPos));
-        pTextLayout = pNewScriptRun.get();
+        oNewScriptRun.emplace(pStr, rArgs.mnEndCharPos);
+        pTextLayout = &*oNewScriptRun;
     }
 
     // nBaseOffset is used to align vertical text to the center of rotated

Reply via email to