sw/source/core/view/viewsh.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 16611f973ceb4ee4d4778a928ac6ad4bac93b5fd
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Jul 1 09:24:54 2025 +0100
Commit:     Michael Stahl <michael.st...@collabora.com>
CommitDate: Wed Jul 2 10:29:13 2025 +0200

    null GetSfxViewShell() deref
    
     #0  0x00007d2c05299b40 in SwViewShell::SizeChgNotify 
(this=this@entry=0x3cd9f220) at sw/source/core/view/viewsh.cxx:1264
     #1  0x00007d2c04e7bfb8 in AdjustSizeChgNotify 
(pRoot=pRoot@entry=0x3c9a1af0) at sw/source/core/layout/pagechg.cxx:894
     #2  0x00007d2c04e7fa5d in SwRootFrame::CheckViewLayout (this=0x3c9a1af0, 
pViewOpt=pViewOpt@entry=0x0, pVisArea=pVisArea@entry=0x0)
         at sw/source/core/layout/pagechg.cxx:2490
     #3  0x00007d2c04e81819 in SwPageFrame::Paste (this=this@entry=0x3cf5c9b0, 
pParent=pParent@entry=0x3c9a1af0, pSibling=pSibling@entry=0x3cebf0d0)
         at sw/source/core/layout/pagechg.cxx:1010
     #4  0x00007d2c04e8498b in (anonymous namespace)::doInsertPage 
(pRoot=0x3c9a1af0, pRefSibling=0x7ffce60d5450, pFormat=<optimized out>, 
pDesc=<optimized out>, bFootnote=<optimized out>, pRefPage=0x7ffce60d5458)
         at sw/source/core/layout/pagechg.cxx:1396
     #5  0x00007d2c04e852a4 in SwFrame::InsertPage (this=this@entry=0x3cebe640, 
pPrevPage=0x3cebb780, bFootnote=bFootnote@entry=false)
         at sw/source/core/layout/pagechg.cxx:1475
     #6  0x00007d2c04eb3787 in SwFrame::GetNextSctLeaf (this=0x3cebe640, 
eMakePage=MAKEPAGE_INSERT) at sw/source/core/layout/sectfrm.cxx:1853
     #7  0x00007d2c04e35530 in SwFlowFrame::MoveFwd 
(this=this@entry=0x3cebe720, bMakePage=<optimized out>, 
bPageBreak=bPageBreak@entry=false, bMoveAlways=bMoveAlways@entry=false)
         at sw/source/core/layout/flowfrm.cxx:2148
     #8  0x00007d2c04e24732 in SwContentFrame::MakeAll (this=0x3cebe640) at 
sw/source/core/layout/calcmove.cxx:1930
     #9  0x00007d2c04e2184c in SwFrame::PrepareMake (this=0x3cebe640, 
pRenderContext=0x3c95db30) at sw/source/core/layout/calcmove.cxx:396
     #10 0x00007d2c04e3abe4 in CalcContent (pLay=pLay@entry=0x3ce01530, 
bNoColl=bNoColl@entry=false) at sw/source/core/layout/fly.cxx:1764
     #11 0x00007d2c04ee2079 in SwLayoutFrame::FormatWidthCols 
(this=this@entry=0x3ce01530, rAttrs=..., nBorder=nBorder@entry=0, 
nMinHeight=nMinHeight@entry=23)
         at sw/source/core/layout/wsfrm.cxx:4013
    
    (gdb) print mpSfxViewShell
    $3 = (SfxViewShell *) 0x0
    
    Change-Id: I2e0f21a442791260e8b79e38965c8da7e41656cc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187225
    Reviewed-by: Michael Stahl <michael.st...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 656a957a8ea3..bf543ddf89d3 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1255,14 +1255,14 @@ void SwViewShell::SizeChgNotify()
         {
             PageNumNotify(this);
 
-            if (comphelper::LibreOfficeKit::isActive())
+            if (SfxViewShell* pNotifySh = 
comphelper::LibreOfficeKit::isActive() ? GetSfxViewShell() : nullptr)
             {
                 Size aDocSize = GetDocSize();
                 OString sPayload = OString::number(aDocSize.Width() + 2 * 
DOCUMENTBORDER) +
                     ", " + OString::number(aDocSize.Height() + 2 * 
DOCUMENTBORDER);
 
-                SwXTextDocument* pModel = 
comphelper::getFromUnoTunnel<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument());
-                SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), 
sPayload, pModel);
+                SwXTextDocument* pModel = 
comphelper::getFromUnoTunnel<SwXTextDocument>(pNotifySh->GetCurrentDocument());
+                SfxLokHelper::notifyDocumentSizeChanged(pNotifySh, sPayload, 
pModel);
             }
         }
     }

Reply via email to