sw/source/core/access/accpara.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 9c86a3f4378b1421b8970a426ba66bc62e82750c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Jan 21 16:20:29 2023 +0000
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 23 09:58:44 2023 +0000

    rhbz#2162862 null pFrame during teardown
    
    Change-Id: Iad2de93f0400b0ec49dae4c3d6979957784114f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145935
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 2e3b1a683f490384bedd925cb57dc9bc9f5c6cf1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145944

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 94a1df603c4a..f3b0d90709dc 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -433,15 +433,18 @@ bool SwAccessibleParagraph::HasCursor()
 void SwAccessibleParagraph::UpdatePortionData()
 {
     // obtain the text frame
-    OSL_ENSURE( GetFrame() != nullptr, "The text frame has vanished!" );
-    OSL_ENSURE( GetFrame()->IsTextFrame(), "The text frame has mutated!" );
     const SwTextFrame* pFrame = static_cast<const SwTextFrame*>( GetFrame() );
-
-    // build new portion data
-    m_pPortionData.reset( new SwAccessiblePortionData(
-        pFrame, GetMap()->GetShell()->GetViewOptions()) );
-    pFrame->VisitPortions( *m_pPortionData );
-
+    OSL_ENSURE( pFrame != nullptr, "The text frame has vanished!" );
+    if (!pFrame)
+        ClearPortionData();
+    else
+    {
+        OSL_ENSURE( pFrame->IsTextFrame(), "The text frame has mutated!" );
+        // build new portion data
+        m_pPortionData.reset( new SwAccessiblePortionData(
+            pFrame, GetMap()->GetShell()->GetViewOptions()) );
+        pFrame->VisitPortions( *m_pPortionData );
+    }
     OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" );
 }
 

Reply via email to