So, I can't reproduce this one myself, but from the reported backtrace I
can see that the immediate crash would be caught by some band-aids to
not crash that are already in master already.
Do we want this for 3-4. Probable workaround is attached.
C.
From 3524727db0f3cfecf3a47046795c527808c10c3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 23 Jun 2011 15:14:00 +0100
Subject: [PATCH] Related: #i58612# don't crash anyway
---
sw/source/core/text/frmform.cxx | 11 ++++++-----
sw/source/core/text/inftxt.cxx | 3 ++-
sw/source/core/text/txtfly.cxx | 6 ++++--
sw/source/core/text/txtfrm.cxx | 7 +++++--
4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 6a4be32..6b3b9cc 100755
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1463,10 +1463,11 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() )
{
- const SwLineLayout* pLine;
+ SwTxtFrm *pMaster = FindMaster();
+ OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
+ const SwLineLayout* pLine=NULL;
+ if (pMaster)
{
- SwTxtFrm *pMaster = FindMaster();
- OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
if( !pMaster->HasPara() )
pMaster->GetFormatted();
SwTxtSizeInfo aInf( pMaster );
@@ -1474,8 +1475,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
aMasterLine.Bottom();
pLine = aMasterLine.GetCurr();
}
- SwLinePortion* pRest =
- rLine.MakeRestPortion( pLine, GetOfst() );
+ SwLinePortion* pRest = pLine ?
+ rLine.MakeRestPortion(pLine, GetOfst()) : NULL;
if( pRest )
rInf.SetRest( pRest );
else
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 570b3c6..a76d746 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1465,7 +1465,8 @@ void SwTxtFormatInfo::Init()
if ( GetTxtFrm()->IsFollow() )
{
const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
- const SwLinePortion* pTmpPara = pMaster->GetPara();
+ OSL_ENSURE(pMaster, "pTxtFrm without Master");
+ const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL;
// there is a master for this follow and the master does not have
// any contents (especially it does not have a number portion)
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 2d21ece..fbff110 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -890,7 +890,7 @@ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const
const SwCntntFrm* SwTxtFly::_GetMaster()
{
pMaster = pCurrFrm;
- while( pMaster->IsFollow() )
+ while( pMaster && pMaster->IsFollow() )
pMaster = (SwCntntFrm*)pMaster->FindMaster();
return pMaster;
}
@@ -1551,7 +1551,9 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
SwTwips SwTxtFly::CalcMinBottom() const
{
SwTwips nRet = 0;
- const SwSortedObjs *pDrawObj = GetMaster()->GetDrawObjs();
+ const SwCntntFrm *pLclMaster = GetMaster();
+ OSL_ENSURE(pLclMaster, "SwTxtFly without master");
+ const SwSortedObjs *pDrawObj = pLclMaster ? pLclMaster->GetDrawObjs() : NULL;
const sal_uInt32 nCount = pDrawObj ? pDrawObj->Count() : 0;
if( nCount )
{
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6e5f764..9e4a237 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -646,9 +646,12 @@ void SwTxtFrm::HideAndShowObjects()
}
}
- if ( IsFollow() )
+ if (IsFollow())
{
- FindMaster()->HideAndShowObjects();
+ SwTxtFrm *pMaster = FindMaster();
+ OSL_ENSURE(pMaster, "SwTxtFrm without master");
+ if (pMaster)
+ pMaster->HideAndShowObjects();
}
}
--
1.7.6.4
Context
- [Libreoffice] [REVIEW] band-aid for fdo#42534 crash in writer layout · Caolán McNamara
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.