summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/hffrm.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-04-23 22:52:39 +0200
committerMichael Stahl <mstahl@redhat.com>2015-04-24 12:22:01 +0200
commit135e4d5c730b8b252eab3e375580a3a73d8204e6 (patch)
tree963acb55d8d7157e3ee98e9a65e823017591902e /sw/source/core/layout/hffrm.cxx
parent4e353190b68f3a89c43b3861444dd2dd6b02a6e0 (diff)
related: tdf#90820 refactor SwFrm destruction
Move all logic out of destructors, so it cannot happen any more that members of a sub-class are accessed from a superclass destructor, when those members are already dead. Logic is now in virtual DestroyImpl() methods. All SwFrms must be deleted with SwFrm::DestroySwFrm(). Change-Id: Icec5b12e12d5a2d955cb5844d7d4f7ac85ab79cd
Diffstat (limited to 'sw/source/core/layout/hffrm.cxx')
-rw-r--r--sw/source/core/layout/hffrm.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index 26a87e1f11e7..7d4dcb5a63e2 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -654,7 +654,7 @@ void DelFlys( SwLayoutFrm *pFrm, SwPageFrm *pPage )
SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj);
if ( pFrm->IsAnLower( pFlyFrm ) )
{
- delete pFlyFrm;
+ SwFrm::DestroyFrm(pFlyFrm);
// Do not increment index, in this case
continue;
}
@@ -687,7 +687,7 @@ void SwPageFrm::PrepareHeader()
pLay = static_cast<SwLayoutFrm*>(pLay->GetNext());
::DelFlys( pDel, this );
pDel->Cut();
- delete pDel;
+ SwFrm::DestroyFrm(pDel);
}
OSL_ENSURE( pLay, "Where to with the Header?" );
SwHeaderFrm *pH = new SwHeaderFrm( const_cast<SwFrmFmt*>(rH.GetHeaderFmt()), this );
@@ -699,7 +699,7 @@ void SwPageFrm::PrepareHeader()
{ // Remove header if present.
::DelFlys( pLay, this );
pLay->Cut();
- delete pLay;
+ SwFrm::DestroyFrm(pLay);
}
}
@@ -725,9 +725,10 @@ void SwPageFrm::PrepareFooter()
return; // Footer is already the correct one.
if ( pLay->IsFooterFrm() )
- { ::DelFlys( pLay, this );
+ {
+ ::DelFlys( pLay, this );
pLay->Cut();
- delete pLay;
+ SwFrm::DestroyFrm(pLay);
}
SwFooterFrm *pF = new SwFooterFrm( const_cast<SwFrmFmt*>(rF.GetFooterFmt()), this );
pF->Paste( this );
@@ -742,7 +743,7 @@ void SwPageFrm::PrepareFooter()
pShell->VisArea().HasArea() )
pShell->InvalidateWindows( pShell->VisArea() );
pLay->Cut();
- delete pLay;
+ SwFrm::DestroyFrm(pLay);
}
}