sc/source/core/data/column2.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9599edeeea12cb62df53308f820316ee8682575c
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Feb 10 19:27:57 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Feb 10 21:33:06 2024 +0100

    cid#1559951 silence Use after free
    
    Change-Id: I3b64a77bfc8b305d73166eaa14d96301fa1aad05
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163219
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index e5d69434a761..20e365acb06c 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -831,9 +831,9 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
                         nScript = ScGlobal::GetDefaultScriptType();
 
                     const ScPatternAttr* pPattern = GetPattern(nRow);
-                    aOptions.aPattern.setScPatternAttr(pPattern);
                     aOptions.bGetFont = (!ScPatternAttr::areSame(pPattern, 
pOldPattern) || nScript != SvtScriptType::NONE);
-                    pOldPattern = pPattern;
+                    aOptions.aPattern.setScPatternAttr(pPattern);
+                    pOldPattern = aOptions.aPattern.getScPatternAttr();
                     sal_uInt16 nThis = static_cast<sal_uInt16>(GetNeededSize(
                         nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, true, 
aOptions, &pOldPattern));
                     if (nThis && (nThis > nWidth || !bFound))

Reply via email to