summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-05 13:32:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-05 20:30:58 +0100
commit91ff5501892f8c3b11d4d5381e2f3efb5f289da6 (patch)
tree8b6194fbebcc65b99079844fa9aa2b597c216f64 /sw/source/core/layout
parent778d03b59c62d21fd171b81c9fab3ba8496e319d (diff)
replace remaining FlowFrmJoinLockGuard with SwFrmDeleteGuard
Given both tdf#91695 and the remaining crash on novell622972-2.html it seems now safer to replace the remaining FlowFrmJoinLockGuard with SwFrmDeleteGuard and rely on IsDeleteForbidden instead of IsJoinLocked for the crashing layout edge-cases and bundle the IsDeleteForbidden other IsDeleteForbidden users together under SwFrmDeleteGuard Change-Id: I017b6155daa3a6e49c5bee5b21ca4eddcfd5b5c0
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/calcmove.cxx7
-rw-r--r--sw/source/core/layout/flowfrm.cxx8
-rw-r--r--sw/source/core/layout/fly.cxx12
-rw-r--r--sw/source/core/layout/layact.cxx11
4 files changed, 17 insertions, 21 deletions
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 2e925327998e..0d9bbd2be6a1 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -346,9 +346,10 @@ void SwFrm::OptPrepareMake()
if ( GetUpper() && !GetUpper()->IsFooterFrm() &&
!GetUpper()->IsFlyFrm() )
{
- ForbidDelete();
- GetUpper()->Calc(getRootFrm()->GetCurrShell() ? getRootFrm()->GetCurrShell()->GetOut() : 0);
- AllowDelete();
+ {
+ SwFrmDeleteGuard aDeleteGuard(this);
+ GetUpper()->Calc(getRootFrm()->GetCurrShell() ? getRootFrm()->GetCurrShell()->GetOut() : 0);
+ }
OSL_ENSURE( GetUpper(), ":-( Layout unstable (Upper gone)." );
if ( !GetUpper() )
return;
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index c78bc280a23a..2c009176fe3f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -577,10 +577,10 @@ void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling )
bool bInvaLay;
{
- //JoinLock pParent for the lifetime of the Cut/Paste call to avoid
- //SwSectionFrm::MergeNext removing the pParent we're trying to reparent
- //into
- FlowFrmJoinLockGuard aJoinGuard(pParent);
+ //Ensure pParent persists for the lifetime of the Cut/Paste call to
+ //avoid SwSectionFrm::MergeNext removing the pParent we're trying to
+ //reparent into
+ SwFrmDeleteGuard aDeleteGuard(pParent);
pOldParent = CutTree( &m_rThis );
bInvaLay = PasteTree( &m_rThis, pParent, pSibling, pOldParent );
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index ff51d377f405..877e618aa582 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1463,14 +1463,10 @@ void CalcContent( SwLayoutFrm *pLay,
if ( bNoCalcFollow && pFrm->IsTextFrm() )
static_cast<SwTextFrm*>(pFrm)->ForbidFollowFormat();
- const bool bDeleteForbidden(pSect && pSect->IsDeleteForbidden());
- if (pSect && !bDeleteForbidden)
- pSect->ForbidDelete();
-
- pFrm->Calc(pRenderContext);
-
- if (pSect && !bDeleteForbidden)
- pSect->AllowDelete();
+ {
+ SwFrmDeleteGuard aDeleteGuard(pSect);
+ pFrm->Calc(pRenderContext);
+ }
// OD 14.03.2003 #i11760# - reset control flag for follow format.
if ( pFrm->IsTextFrm() )
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 230769f7e8b5..8dfbcbcd3308 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1223,11 +1223,10 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrm *pLay,
aOldRect = static_cast<SwPageFrm*>(pLay)->GetBoundRect(pRenderContext);
}
- bool const bDeleteForbidden(pLay->IsDeleteForbidden());
- pLay->ForbidDelete();
- pLay->Calc(pRenderContext);
- if (!bDeleteForbidden)
- pLay->AllowDelete();
+ {
+ SwFrmDeleteGuard aDeleteGuard(pLay);
+ pLay->Calc(pRenderContext);
+ }
if ( aOldFrame != pLay->Frm() )
bChanged = true;
@@ -1375,7 +1374,7 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrm *pLay,
if ( pLay->IsFootnoteFrm() ) // no LayFrms as Lower
return bChanged;
- FlowFrmJoinLockGuard aJoinGuard(pLay);
+ SwFrmDeleteGuard aDeleteGuard(pLay);
SwFrm *pLow = pLay->Lower();
bool bTabChanged = false;
while ( pLow && pLow->GetUpper() == pLay )