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
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index fc799f0..60711a8 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -160,9 +160,15 @@ SwCntntFrm *SwNoTxtNode::MakeFrm( SwFrm* pSib )
return new SwNoTxtFrm(this, pSib);
}
SwNoTxtFrm::~SwNoTxtFrm()
void SwNoTxtFrm::DestroyImpl()
{
StopAnimation();
SwCntntFrm::DestroyImpl();
}
SwNoTxtFrm::~SwNoTxtFrm()
{
}
void SetOutDev( SwViewShell *pSh, OutputDevice *pOut )
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 746679f..1504807 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1020,7 +1020,7 @@ SwFrm* SwClearDummies( SwFrm* pFrm )
pFrm = pTmp;
if( pTmp )
pTmp->mpPrev = pSectFrm->GetPrev();
delete pSectFrm;
SwFrm::DestroyFrm(pSectFrm);
}
}
else
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index da85f7d..78afb54 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2424,7 +2424,7 @@ void SwTableNode::DelFrms()
}
}
pFrm->Cut();
delete pFrm;
SwFrm::DestroyFrm(pFrm);
bAgain = true;
}
}
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 5e11972..5810b1e 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1372,7 +1372,7 @@ void SwCntntNode::DelFrms( bool bIsDisposeAccTable )
pFrm->Cut();
//Set acc table dispose state to default value
pFrm->SetAccTableDispose( true );
delete pFrm;
SwFrm::DestroyFrm(pFrm);
}
if( bIsDisposeAccTable && IsTxtNode() )
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index d08835d..472be01 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2246,7 +2246,7 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose )
pSctFrm->ColUnlock();
}
}
delete pUp;
SwFrm::DestroyFrm(pUp);
bDel = false; // Row goes to /dev/null.
}
}
@@ -2267,7 +2267,7 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose )
pFrm->Cut();
//Set acc table dispose state to default value.
pFrm->SetAccTableDispose( true );
delete pFrm;
SwFrm::DestroyFrm(pFrm);
}
}
}
@@ -2291,7 +2291,7 @@ static void lcl_UpdateRepeatedHeadlines( SwTabFrm& rTabFrm, bool bCalcLowers )
while ( 0 != ( pLower = static_cast<SwRowFrm*>(rTabFrm.Lower()) ) && pLower->IsRepeatedHeadline() )
{
pLower->Cut();
delete pLower;
SwFrm::DestroyFrm(pLower);
}
// Insert fresh set of headlines:
diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx
index 5be134c..21b73c4 100644
--- a/sw/source/core/inc/cellfrm.hxx
+++ b/sw/source/core/inc/cellfrm.hxx
@@ -32,13 +32,15 @@ class SwCellFrm: public SwLayoutFrm
{
const SwTableBox* m_pTabBox;
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwCellFrm();
protected:
virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
public:
SwCellFrm( const SwTableBox &, SwFrm*, bool bInsertContent = true );
virtual ~SwCellFrm();
virtual bool GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* = 0, bool bTestBackground = false ) const SAL_OVERRIDE;
virtual void Paint( SwRect const&,
diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index b8fae50..ed32b8b 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -63,8 +63,10 @@ protected:
SwCntntFrm( SwCntntNode * const, SwFrm* );
public:
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwCntntFrm();
public:
TYPEINFO_OVERRIDE(); // already in base class
virtual void Cut() SAL_OVERRIDE;
diff --git a/sw/source/core/inc/colfrm.hxx b/sw/source/core/inc/colfrm.hxx
index 84d6e87..33036ba 100644
--- a/sw/source/core/inc/colfrm.hxx
+++ b/sw/source/core/inc/colfrm.hxx
@@ -25,9 +25,12 @@
class SwColumnFrm: public SwFtnBossFrm
{
private:
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwColumnFrm();
public:
SwColumnFrm( SwFrmFmt*, SwFrm* );
virtual ~SwColumnFrm();
virtual void PaintBreak() const SAL_OVERRIDE;
virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const SAL_OVERRIDE;
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index 174aafd..27ccaa4 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -136,6 +136,9 @@ protected:
SwFlyFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwFlyFrm();
/** method to assure that anchored object is registered at the correct
page frame
@@ -157,7 +160,6 @@ public:
// #i26791#
TYPEINFO_OVERRIDE();
virtual ~SwFlyFrm();
// get client information
virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
virtual void Paint( SwRect const&,
diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 489e475..5a49cfb 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -64,12 +64,13 @@ protected:
const SwRect& rRect, PrepareHint eHint) SAL_OVERRIDE;
SwFlyFreeFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwFlyFreeFrm();
public:
// #i28701#
TYPEINFO_OVERRIDE();
virtual ~SwFlyFreeFrm();
virtual void MakeAll() SAL_OVERRIDE;
// #i37068# - accessors for member <mbNoMoveOnCheckClip>
@@ -179,6 +180,9 @@ class SwFlyInCntFrm : public SwFlyFrm
bool bInvalidLayout :1;
bool bInvalidCntnt :1;
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwFlyInCntFrm();
protected:
virtual void NotifyBackground( SwPageFrm *pPage,
const SwRect& rRect, PrepareHint eHint) SAL_OVERRIDE;
@@ -191,7 +195,6 @@ public:
SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
virtual ~SwFlyInCntFrm();
virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 5db5538..56325c3 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -357,12 +357,16 @@ protected:
bool mbInfSct : 1; // Frm is in a section
bool mbColLocked : 1; // lock Grow/Shrink for column-wise section
// or fly frames, will be set in Format
bool m_isInDestroy : 1;
void ColLock() { mbColLocked = true; }
void ColUnlock() { mbColLocked = false; }
void Destroy(); // for ~SwRootFrm
virtual void DestroyImpl();
virtual ~SwFrm();
// Only used by SwRootFrm Ctor to get 'this' into mpRoot...
void setRootFrm( SwRootFrm* pRoot ) { mpRoot = pRoot; }
@@ -807,7 +811,8 @@ public:
bool IsColLocked() const { return mbColLocked; }
virtual ~SwFrm();
/// this is the only way to delete a SwFrm instance
static void DestroyFrm(SwFrm *const pFrm);
bool IsInDtor() const { return mbInDtor; }
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index 7f3774b..e7810c1 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -47,9 +47,13 @@ class SwLayoutFrm: public SwFrm
#endif
void CopySubtree( const SwLayoutFrm *pDest );
protected:
void Destroy(); // for ~SwRootFrm
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwLayoutFrm();
virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
virtual void MakeAll() SAL_OVERRIDE;
@@ -100,7 +104,6 @@ public:
const bool bDefaultExpand = true ) const;
SwLayoutFrm( SwFrmFmt*, SwFrm* );
virtual ~SwLayoutFrm();
virtual void Paint( SwRect const&,
SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx
index 452e200..b27642b 100644
--- a/sw/source/core/inc/notxtfrm.hxx
+++ b/sw/source/core/inc/notxtfrm.hxx
@@ -37,12 +37,15 @@ class SwNoTxtFrm: public SwCntntFrm
void Format ( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
void PaintCntnt ( OutputDevice*, const SwRect&, const SwRect& ) const;
void PaintPicture( OutputDevice*, const SwRect& ) const;
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwNoTxtFrm();
protected:
virtual void MakeAll() SAL_OVERRIDE;
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
public:
SwNoTxtFrm( SwNoTxtNode * const, SwFrm* );
virtual ~SwNoTxtFrm();
virtual void Paint( SwRect const&,
SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index ad3894e..1f19ce7 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -101,6 +101,9 @@ class SwPageFrm: public SwFtnBossFrm
bool bPaintRightShadow,
bool bRightSidebar );
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwPageFrm();
protected:
virtual void MakeAll() SAL_OVERRIDE;
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
@@ -110,7 +113,6 @@ public:
DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm)
SwPageFrm( SwFrmFmt*, SwFrm*, SwPageDesc* );
virtual ~SwPageFrm();
/// Make this public, so that the SwViewShell can access it when switching from browse mode
/// Add/remove header/footer
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index b5dc726..63f8faaf 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -145,6 +145,9 @@ class SwRootFrm: public SwLayoutFrm
void _DeleteEmptySct(); // Destroys the registered SectionFrms
void _RemoveFromList( SwSectionFrm* pSct ); // Removes SectionFrms from the Delete List
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwRootFrm();
protected:
virtual void MakeAll() SAL_OVERRIDE;
@@ -167,7 +170,6 @@ public:
static bool HasSameRect( const SwRect& rRect );
SwRootFrm( SwFrmFmt*, SwViewShell* );
virtual ~SwRootFrm();
void Init(SwFrmFmt*);
SwViewShell *GetCurrShell() const { return mpCurrShell; }
diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx
index 93526e9..e59c2d5 100644
--- a/sw/source/core/inc/rowfrm.hxx
+++ b/sw/source/core/inc/rowfrm.hxx
@@ -45,13 +45,15 @@ class SwRowFrm: public SwLayoutFrm
bool m_bIsRepeatedHeadline;
bool m_bIsRowSpanLine;
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwRowFrm();
protected:
virtual void MakeAll() SAL_OVERRIDE;
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
public:
SwRowFrm( const SwTableLine &, SwFrm*, bool bInsertContent = true );
virtual ~SwRowFrm();
virtual void Cut() SAL_OVERRIDE;
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 228878e..408d4d9 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -53,6 +53,10 @@ class SwSectionFrm: public SwLayoutFrm, public SwFlowFrm
void CalcEndAtEndFlag();
const SwSectionFmt* _GetEndSectFmt() const;
bool IsEndnoteAtMyEnd() const;
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwSectionFrm();
protected:
virtual void MakeAll() SAL_OVERRIDE;
virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool bHead, bool &rReformat ) SAL_OVERRIDE;
@@ -63,7 +67,6 @@ protected:
public:
SwSectionFrm( SwSection &, SwFrm* ); // Content is not created!
SwSectionFrm( SwSectionFrm &, bool bMaster ); // _ONLY_ for creating Master/Follows!
virtual ~SwSectionFrm();
void Init();
virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 408d7c4..593f114 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -102,6 +102,9 @@ class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool bHead, bool &rReformat ) SAL_OVERRIDE;
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwTabFrm();
protected:
virtual void MakeAll() SAL_OVERRIDE;
virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
@@ -112,7 +115,6 @@ protected:
public:
SwTabFrm( SwTable &, SwFrm* ); // calling Regist Flys always after creation _and_pasting!
SwTabFrm( SwTabFrm & ); // _only_ for the creation of follows
virtual ~SwTabFrm();
void JoinAndDelFollows(); // for DelFrms of the TableNodes!
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 8cf2633..7588436 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -204,6 +204,10 @@ class SwTxtFrm: public SwCntntFrm
sal_Int32 nInsertPos, sal_Int32 nActPos,
sal_Int32 &nChgStart, sal_Int32 &nChgEnd,
sal_Int32 &nInvStart, sal_Int32 &nInvEnd);
virtual void DestroyImpl() SAL_OVERRIDE;
virtual ~SwTxtFrm();
protected:
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
@@ -333,7 +337,6 @@ public:
{ return static_cast< const SwTxtNode* >( SwCntntFrm::GetNode()); }
SwTxtFrm(SwTxtNode * const, SwFrm* );
virtual ~SwTxtFrm();
/**
* SwCntntFrm: the shortcut for the Frames
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index dda591b..f92ec8b 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2645,7 +2645,7 @@ void SwFrmFmt::DelFrms()
if( pLast )
do {
pLast->Cut();
delete pLast;
SwFrm::DestroyFrm(pLast);
} while( 0 != ( pLast = aIter.Next() ));
}
@@ -2852,8 +2852,9 @@ SwFlyFrmFmt::~SwFlyFrmFmt()
SwIterator<SwFlyFrm,SwFmt> aIter( *this );
SwFlyFrm * pLast = aIter.First();
if( pLast )
do {
delete pLast;
do
{
SwFrm::DestroyFrm(pLast);
} while( 0 != ( pLast = aIter.Next() ));
SwIterator<SwFlyDrawContact,SwFmt> a2ndIter( *this );
@@ -3269,7 +3270,7 @@ SwHandleAnchorNodeChg::SwHandleAnchorNodeChg( SwFlyFrmFmt& _rFlyFrmFmt,
if ( pFrm != _pKeepThisFlyFrm )
{
pFrm->Cut();
delete pFrm;
SwFrm::DestroyFrm(pFrm);
}
} while( 0 != ( pFrm = aIter.Next() ));
}
diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index c012fea..23ef755 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -41,7 +41,7 @@ SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt, SwFrm* pSib ):
SetMaxFtnHeight( LONG_MAX );
}
SwColumnFrm::~SwColumnFrm()
void SwColumnFrm::DestroyImpl()
{
SwFrmFmt *pFmt = GetFmt();
SwDoc *pDoc;
@@ -52,6 +52,12 @@ SwColumnFrm::~SwColumnFrm()
pDoc->GetDfltFrmFmt()->Add( this );
pDoc->DelFrmFmt( pFmt );
}
SwFtnBossFrm::DestroyImpl();
}
SwColumnFrm::~SwColumnFrm()
{
}
static void lcl_RemoveColumns( SwLayoutFrm *pCont, sal_uInt16 nCnt )
@@ -71,7 +77,7 @@ static void lcl_RemoveColumns( SwLayoutFrm *pCont, sal_uInt16 nCnt )
{
SwColumnFrm *pTmp = static_cast<SwColumnFrm*>(pColumn->GetPrev());
pColumn->Cut();
delete pColumn; //format is going to be destroyed in the DTor if needed.
SwFrm::DestroyFrm(pColumn); //format is going to be destroyed in the DTor if needed.
pColumn = pTmp;
}
}
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 6c88769..4fc786d 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -397,7 +397,7 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart )
!static_cast<SwFtnFrm*>(pLay)->IsBackMoveLocked() )
{
pLay->Cut();
delete pLay;
SwFrm::DestroyFrm(pLay);
}
else
{
@@ -2311,7 +2311,7 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat )
if( pNewUpper->IsFtnContFrm() )
{
pNewUpper->Cut();
delete pNewUpper;
SwFrm::DestroyFrm(pNewUpper);
}
else
{
@@ -2322,7 +2322,7 @@ bool SwFlowFrm::MoveBwd( bool &rbReformat )
!pSectFrm->ContainsCntnt() && !pSectFrm->ContainsAny( true ) )
{
pSectFrm->DelEmpty( true );
delete pSectFrm;
SwFrm::DestroyFrm(pSectFrm);
m_rThis.mbValidPos = true;
}
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index bdfe3f9..3cac9d7 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -234,7 +234,7 @@ void SwFlyFrm::InsertColumns()
}
}
SwFlyFrm::~SwFlyFrm()
void SwFlyFrm::DestroyImpl()
{
// Accessible objects for fly frames will be destroyed in this destructor.
// For frames bound as char or frames that don't have an anchor we have
@@ -272,6 +272,12 @@ SwFlyFrm::~SwFlyFrm()
// Hack to make sure code called from base ~SwLayoutFrm does not interpret
// this as a SwFlyFrm (which it no longer is by then):
mnFrmType = FRM_UNUSED;
SwLayoutFrm::DestroyImpl();
}
SwFlyFrm::~SwFlyFrm()
{
}
const IDocumentDrawModelAccess* SwFlyFrm::getIDocumentDrawModelAccess()
@@ -302,7 +308,9 @@ void SwFlyFrm::DeleteCnt()
{
SwAnchoredObject *pAnchoredObj = (*pFrm->GetDrawObjs())[0];
if ( pAnchoredObj->ISA(SwFlyFrm) )
delete pAnchoredObj;
{
SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj));
}
else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) )
{
// OD 23.06.2003 #108784# - consider 'virtual' drawing objects
@@ -326,7 +334,7 @@ void SwFlyFrm::DeleteCnt()
}
pFrm->RemoveFromLayout();
delete pFrm;
SwFrm::DestroyFrm(pFrm);
pFrm = m_pLower;
}
@@ -511,7 +519,7 @@ void SwFlyFrm::ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow )
SwFrm *pFrm = pFollow->ContainsCntnt();
OSL_ENSURE( !pFrm->IsTabFrm() && !pFrm->FindNext(), "follow in chain contains content" );
pFrm->Cut();
delete pFrm;
SwFrm::DestroyFrm(pFrm);
}
// invalidate accessible relation set (accessibility wrapper)
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index bd6b789..fd59530 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -732,7 +732,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
{
SwFrm *pDel = const_cast<SwFrm*>(pLay);
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
return pPre;
}
return 0;
@@ -841,7 +841,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
{
SwFrm *pDel = const_cast<SwFrm*>(pLay);
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
return 0;
}
return pLay;
diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index 333ed61..1d9c8ba 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -41,13 +41,19 @@ SwFlyInCntFrm::SwFlyInCntFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) :
SetCurrRelPos( aRelPos );
}
SwFlyInCntFrm::~SwFlyInCntFrm()
void SwFlyInCntFrm::DestroyImpl()
{
if ( !GetFmt()->GetDoc()->IsInDtor() && GetAnchorFrm() )
{
SwRect aTmp( GetObjRectWithSpaces() );
SwFlyInCntFrm::NotifyBackground( FindPageFrm(), aTmp, PREP_FLY_LEAVE );
}
SwFlyFrm::DestroyImpl();
}
SwFlyInCntFrm::~SwFlyInCntFrm()
{
}
// #i28701#
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 0243f0d..61ce8bb 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -54,7 +54,7 @@ SwFlyFreeFrm::SwFlyFreeFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) :
{
}
SwFlyFreeFrm::~SwFlyFreeFrm()
void SwFlyFreeFrm::DestroyImpl()
{
// #i28701# - use new method <GetPageFrm()>
if( GetPageFrm() )
@@ -78,6 +78,12 @@ SwFlyFreeFrm::~SwFlyFreeFrm()
SwFlyFreeFrm::NotifyBackground( GetPageFrm(), aTmp, PREP_FLY_LEAVE );
}
}
SwFlyFrm::DestroyImpl();
}
SwFlyFreeFrm::~SwFlyFreeFrm()
{
}
// #i28701#
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 8323e18..f61907a 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1507,7 +1507,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
pLay = pTmpFrm->GetUpper();
pPrv = pTmpFrm->GetPrev();
pTmpFrm->RemoveFromLayout();
delete pTmpFrm;
SwFrm::DestroyFrm(pTmpFrm);
}
else
{
@@ -1540,7 +1540,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
! pOuterSectionFrm->ContainsCntnt() )
{
pOuterSectionFrm->DelEmpty( true );
delete pOuterSectionFrm;
SwFrm::DestroyFrm(pOuterSectionFrm);
}
pActualSection->SetSectionFrm( static_cast<SwSectionFrm*>(pFrm) );
@@ -1585,7 +1585,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
if ( !(pLay = pActualSection->GetSectionFrm())->ContainsCntnt() )
{
pLay->RemoveFromLayout();
delete pLay;
SwFrm::DestroyFrm(pLay);
}
delete pActualSection;
}
@@ -1809,7 +1809,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
{
pSct->DelEmpty( true );
pUpper->getRootFrm()->RemoveFromList( pSct );
delete pSct;
SwFrm::DestroyFrm(pSct);
}
}
}
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 51f17f6..6a02d28 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -520,7 +520,7 @@ void SwFtnFrm::Cut()
}
SwSectionFrm* pSect = pUp->FindSctFrm();
pUp->Cut();
delete pUp;
SwFrm::DestroyFrm(pUp);
// If the last footnote container was removed from a column
// section without a Follow, then this section can be shrunk.
if( pSect && !pSect->ToMaximize( false ) && !pSect->IsColLocked() )
@@ -567,7 +567,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
MoveSubTree( this, GetLower() );
SwFrm *pDel = GetPrev();
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
if ( GetNext() && GetNext() == GetFollow() )
{ OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ),
@@ -575,7 +575,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
(SwFlowFrm::CastFlowFrm( GetNext()->GetLower()))->MoveSubTree( this );
SwFrm *pDel = GetNext();
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
#if OSL_DEBUG_LEVEL > 0
SwDoc *pDoc = GetFmt()->GetDoc();
@@ -850,7 +850,7 @@ void sw_RemoveFtns( SwFtnBossFrm* pBoss, bool bPageOnly, bool bEndNotes )
if ( bPageOnly && !pNxt )
pNxt = pFtn->GetFollow();
pFtn->Cut();
delete pFtn;
SwFrm::DestroyFrm(pFtn);
}
pFtn = pNxt;
@@ -904,7 +904,7 @@ void SwRootFrm::RemoveFtns( SwPageFrm *pPage, bool bPageOnly, bool bEndNotes )
SwFrm *pDel = pPage;
pPage = static_cast<SwPageFrm*>(pPage->GetNext());
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
else
pPage = static_cast<SwPageFrm*>(pPage->GetNext());
@@ -1133,7 +1133,7 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck )
{
SwFtnFrm *pNxt = pFtn->GetFollow();
pFtn->Cut();
delete pFtn;
SwFrm::DestroyFrm(pFtn);
pFtn = pNxt;
}
}
@@ -1602,13 +1602,13 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
!pNew->IsColLocked() && !pNew->IsBackMoveLocked() )
{
pNew->Cut();
delete pNew;
SwFrm::DestroyFrm(pNew);
}
}
pMyPage->UpdateFtnNum();
}
else
delete pNew;
SwFrm::DestroyFrm(pNew);
}
SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr )
@@ -1661,7 +1661,7 @@ void SwFtnBossFrm::RemoveFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr,
{
SwFtnFrm *pFoll = pFtn->GetFollow();
pFtn->Cut();
delete pFtn;
SwFrm::DestroyFrm(pFtn);
pFtn = pFoll;
} while ( pFtn );
if( bPrep && pRef->IsFollow() )
@@ -1868,7 +1868,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
{
OSL_ENSURE( !pNxt, "footnote without content?" );
pNxt->Cut();
delete pNxt;
SwFrm::DestroyFrm(pNxt);
}
pNxt = _pFtn->GetFollow();
}
@@ -1992,7 +1992,7 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, bool bCalc )
if( !pFtn->ContainsAny() && !pFtn->IsColLocked() )
{
pFtn->Cut();
delete pFtn;
SwFrm::DestroyFrm(pFtn);
// #i21478#
pFtn = 0L;
}
@@ -2010,7 +2010,7 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, bool bCalc )
else
{ OSL_ENSURE( !pFtn->GetMaster() && !pFtn->GetFollow(),
"DelFtn and Master/Follow?" );
delete pFtn;
SwFrm::DestroyFrm(pFtn);
// #i21478#
pFtn = 0L;
}
@@ -2187,7 +2187,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const bool bLock,
!pLastFtnFrm->IsBackMoveLocked() )
{
pLastFtnFrm->Cut();
delete pLastFtnFrm;
SwFrm::DestroyFrm(pLastFtnFrm);
pLastFtnFrm = 0L;
}
}
@@ -2239,7 +2239,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const bool bLock,
"<SwFtnBossFrm::RearrangeFtns(..)> - <pLastFtnFrm> != <pFtnFrm>" );
pLastFtnFrm = 0L;
pFtnFrm->Cut();
delete pFtnFrm;
SwFrm::DestroyFrm(pFtnFrm);
}
}
}
@@ -2294,7 +2294,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const bool bLock,
pDel->Cut();
if (bUnlockLastFtnFrmGuard)
pLastFtnFrm->ColUnlock();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
if ( bMore )
{
@@ -2322,7 +2322,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const bool bLock,
!pLastFtnFrm->IsBackMoveLocked() )
{
pLastFtnFrm->Cut();
delete pLastFtnFrm;
SwFrm::DestroyFrm(pLastFtnFrm);
}
}
}
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index 26a87e1..7d4dcb5 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);
}
}
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index dbc90fd..af7fee2 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -334,7 +334,7 @@ bool SwLayAction::RemoveEmptyBrowserPages()
SwPageFrm *pDel = pPage;
pPage = static_cast<SwPageFrm*>(pPage->GetNext());
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
} while ( pPage );
}
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index 53d8238..80e180c 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -94,7 +94,7 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
{ OSL_ENSURE( pNxt->Lower() && pNxt->Lower()->IsSctFrm(),
"Endnote without content?" );
pNxt->Cut();
delete pNxt;
SwFrm::DestroyFrm(pNxt);
}
pNxt = pFtn->GetFollow();
}
@@ -109,7 +109,7 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
SwFtnFrm *pEndFtn = (*pEndArr)[i];
if( pEndFtn->GetAttr() == pFtn->GetAttr() )
{
delete pFtn;
SwFrm::DestroyFrm(pFtn);
return;
}
}
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 7a204cc..a3a6609 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -573,7 +573,7 @@ void SwRootFrm::Init( SwFrmFmt* pFmt )
mbNeedGrammarCheck = pViewSh->GetViewOptions()->IsOnlineSpell();
}
SwRootFrm::~SwRootFrm()
void SwRootFrm::DestroyImpl()
{
mbTurboAllowed = false;
mpTurbo = 0;
@@ -614,6 +614,12 @@ SwRootFrm::~SwRootFrm()
// that accesses members of this
SwLayoutFrm::Destroy();
SwFrm::Destroy();
SwLayoutFrm::DestroyImpl();
}
SwRootFrm::~SwRootFrm()
{
}
void SwRootFrm::RemoveMasterObjs( SdrPage *pPg )
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 6194044..d49c1e4 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -217,7 +217,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) :
}
}
SwPageFrm::~SwPageFrm()
void SwPageFrm::DestroyImpl()
{
// Cleanup the header-footer controls in the SwEditWin
SwViewShell* pSh = getRootFrm()->GetCurrShell();
@@ -267,6 +267,12 @@ SwPageFrm::~SwPageFrm()
// Hack to make sure code called from base ~SwFtnBossFrm does not interpret
// this as a SwPageFrm (which it no longer is by then):
mnFrmType = FRM_UNUSED;
SwFtnBossFrm::DestroyImpl();
}
SwPageFrm::~SwPageFrm()
{
}
void SwPageFrm::CheckGrid( bool bInvalidate )
@@ -1025,7 +1031,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
bool bUpdatePrev = false;
if (ppPrev && *ppPrev == pPage)
bUpdatePrev = true;
delete pPage;
SwFrm::DestroyFrm(pPage);
if ( pStart == pPage )
pStart = pTmp;
pPage = pTmp;
@@ -1101,7 +1107,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
bool bUpdatePrev = false;
if (ppPrev && *ppPrev == pPage)
bUpdatePrev = true;
delete pPage;
SwFrm::DestroyFrm(pPage);
if ( pStart == pPage )
pStart = pTmp;
pPage = pTmp;
@@ -1196,7 +1202,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFtn )
if ( !pDoc->GetFtnIdxs().empty() )
pRoot->RemoveFtns( pDel, true );
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
else
bCheckPages = true;
@@ -1217,7 +1223,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFtn )
if ( !pDoc->GetFtnIdxs().empty() )
pRoot->RemoveFtns( pDel, true );
pDel->Cut();
delete pDel;
SwFrm::DestroyFrm(pDel);
}
else
bCheckPages = true;
@@ -1365,7 +1371,7 @@ void SwRootFrm::RemoveSuperfluous()
if ( !GetFmt()->GetDoc()->GetFtnIdxs().empty() )
RemoveFtns( pEmpty, true );
pEmpty->Cut();
delete pEmpty;
SwFrm::DestroyFrm(pEmpty);
nDocPos = pPage ? pPage->Frm().Top() : 0;
}
} while ( pPage );
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 9b50f93f..02c4526 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -117,7 +117,7 @@ void SwSectionFrm::Init()
}
}
SwSectionFrm::~SwSectionFrm()
void SwSectionFrm::DestroyImpl()
{
if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
{
@@ -144,6 +144,12 @@ SwSectionFrm::~SwSectionFrm()
PROTOCOL( this, PROT_SECTION, ACT_DEL_MASTER, GetFollow() )
}
}
SwLayoutFrm::DestroyImpl();
}
SwSectionFrm::~SwSectionFrm()
{
}
void SwSectionFrm::DelEmpty( bool bRemove )
@@ -262,7 +268,7 @@ void SwSectionFrm::_Cut( bool bRemove )
pUp->GetUpper() )
{
pUp->Cut();
delete pUp;
SwFrm::DestroyFrm(pUp);
pUp = NULL;
}
}
@@ -443,7 +449,7 @@ void SwSectionFrm::MergeNext( SwSectionFrm* pNxt )
SetFollow( pNxt->GetFollow() );
pNxt->SetFollow( NULL );
pNxt->Cut();
delete pNxt;
SwFrm::DestroyFrm(pNxt);
InvalidateSize();
}
}
@@ -618,7 +624,7 @@ void SwSectionFrm::MoveCntntAndDelete( SwSectionFrm* pDel, bool bSave )
static_cast<SwFtnFrm*>(pUp)->ColLock();
}
pDel->DelEmpty( true );
delete pDel;
SwFrm::DestroyFrm(pDel);
if( pParent )
{ // Search for the appropriate insert position
if( pNxtSct && pNxtSct->GetFmt() == pParent )
@@ -2557,7 +2563,7 @@ void SwRootFrm::_DeleteEmptySct()
{
SwLayoutFrm* pUp = pSect->GetUpper();
pSect->RemoveFromLayout();
delete pSect;
SwFrm::DestroyFrm(pSect);
if( pUp && !pUp->Lower() )
{
if( pUp->IsPageBodyFrm() )
@@ -2566,7 +2572,7 @@ void SwRootFrm::_DeleteEmptySct()
pUp->GetUpper() )
{
pUp->Cut();
delete pUp;
SwFrm::DestroyFrm(pUp);
}
}
}
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 663733e..1f8a5f7 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -350,7 +350,9 @@ void SwFrm::Destroy()
{
SwAnchoredObject* pAnchoredObj = (*mpDrawObjs)[--i];
if ( pAnchoredObj->ISA(SwFlyFrm) )
delete pAnchoredObj;
{
SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj));
}
else
{
SdrObject* pSdrObj = pAnchoredObj->DrawObj();
@@ -369,19 +371,34 @@ void SwFrm::Destroy()
}
}
SwFrm::~SwFrm()
void SwFrm::DestroyImpl()
{
if (!IsRootFrm()) // ~SwRootFrm already calls Destroy!
{
Destroy();
}
}
SwFrm::~SwFrm()
{
assert(m_isInDestroy); // check that only DestroySwFrm does "delete"
#if OSL_DEBUG_LEVEL > 0
// JP 15.10.2001: for detection of access to deleted frames
mpDrawObjs = reinterpret_cast<SwSortedObjs*>(0x33333333);
#endif
}
void SwFrm::DestroyFrm(SwFrm *const pFrm)
{
if (pFrm)
{
pFrm->m_isInDestroy = true;
pFrm->DestroyImpl();
assert(pFrm->mbInDtor); // check that nobody forgot to call base class
delete pFrm;
}
}
const SwFrmFmt * SwLayoutFrm::GetFmt() const
{
return static_cast< const SwFrmFmt * >( GetDep() );
@@ -409,7 +426,7 @@ SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt, SwFrm* pSib ) :
{
}
SwCntntFrm::~SwCntntFrm()
void SwCntntFrm::DestroyImpl()
{
const SwCntntNode* pCNd;
if( 0 != ( pCNd = PTR_CAST( SwCntntNode, GetRegisteredIn() )) &&
@@ -423,6 +440,12 @@ SwCntntFrm::~SwCntntFrm()
pRoot->ResetTurbo();
}
}
SwFrm::DestroyImpl();
}
SwCntntFrm::~SwCntntFrm()
{
}
void SwCntntFrm::RegisterToNode( SwCntntNode& rNode )
@@ -458,7 +481,7 @@ void SwLayoutFrm::Destroy()
SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[0];
if ( pAnchoredObj->ISA(SwFlyFrm) )
{
delete pAnchoredObj;
SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj));
assert(!pFrm->GetDrawObjs() || nCnt > pFrm->GetDrawObjs()->size());
}
else
@@ -481,7 +504,7 @@ void SwLayoutFrm::Destroy()
}
}
pFrm->RemoveFromLayout();
delete pFrm;
SwFrm::DestroyFrm(pFrm);
pFrm = m_pLower;
}
//Delete the Flys, the last one also deletes the array.
@@ -493,7 +516,7 @@ void SwLayoutFrm::Destroy()
SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[0];
if ( pAnchoredObj->ISA(SwFlyFrm) )
{
delete pAnchoredObj;
SwFrm::DestroyFrm(static_cast<SwFlyFrm*>(pAnchoredObj));
assert(!GetDrawObjs() || nCnt > GetDrawObjs()->size());
}
else
@@ -520,18 +543,24 @@ void SwLayoutFrm::Destroy()
while( pFrm )
{
SwFrm *pNxt = pFrm->GetNext();
delete pFrm;
SwFrm::DestroyFrm(pFrm);
pFrm = pNxt;
}
}
}
SwLayoutFrm::~SwLayoutFrm()
void SwLayoutFrm::DestroyImpl()
{
if (!IsRootFrm()) // ~SwRootFrm already calls Destroy!
{
Destroy();
}
SwFrm::DestroyImpl();
}
SwLayoutFrm::~SwLayoutFrm()
{
}
/**
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 20145d5..79dc690 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -91,7 +91,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab, SwFrm* pSib )
pTmpPrev = pNew;
}
else
delete pNew;
SwFrm::DestroyFrm(pNew);
}
OSL_ENSURE( Lower() && Lower()->IsRowFrm(), "SwTabFrm::SwTabFrm: No rows." );
}
@@ -142,7 +142,7 @@ SwTabFrm* SwTabFrm::GetFollowFlowLineFor()
return NULL;
}
SwTabFrm::~SwTabFrm()
void SwTabFrm::DestroyImpl()
{
//rhbz#907933, we are a follow flow line for something and have been
//deleted, remove ourself as a follow flowline
@@ -163,6 +163,12 @@ SwTabFrm::~SwTabFrm()
pRowCacheLastTabFrm = NULL;
pRowCacheLastCellFrm= NULL;
}
SwLayoutFrm::DestroyImpl();
}
SwTabFrm::~SwTabFrm()
{
}
void SwTabFrm::JoinAndDelFollows()
@@ -172,7 +178,7 @@ void SwTabFrm::JoinAndDelFollows()
pFoll->JoinAndDelFollows();
pFoll->Cut();
SetFollow( pFoll->GetFollow() );
delete pFoll;
SwFrm::DestroyFrm(pFoll);
}
void SwTabFrm::RegistFlys()
@@ -414,7 +420,7 @@ static void lcl_MoveRowContent( SwRowFrm& rSourceLine, SwRowFrm& rDestLine )
lcl_MoveRowContent( *pTmpSourceRow, *pTmpDestRow );
pTmpDestRow->SetFollowRow( pTmpSourceRow->GetFollowRow() );
pTmpSourceRow->RemoveFromLayout();
delete pTmpSourceRow;
SwFrm::DestroyFrm(pTmpSourceRow);
}
else
{
@@ -586,7 +592,7 @@ static void lcl_PostprocessRowsInCells( SwTabFrm& rTab, SwRowFrm& rLastLine )
pRowFrm->SetFollowRow( pFollowRow->GetFollowRow() );
lcl_MoveRowContent( *pFollowRow, *pRowFrm );
pFollowRow->Cut();
delete pFollowRow;
SwFrm::DestroyFrm(pFollowRow);
::SwInvalidateAll( pCurrMasterCell, LONG_MAX );
}
}
@@ -855,7 +861,7 @@ bool SwTabFrm::RemoveFollowFlowLine()
bool bJoin = !pFollowFlowLine->GetNext();
pFollowFlowLine->Cut();
delete pFollowFlowLine;
SwFrm::DestroyFrm(pFollowFlowLine);
return bJoin;
}
@@ -1251,7 +1257,7 @@ bool SwTabFrm::Join()
SetFollow( pFoll->GetFollow() );
SetFollowFlowLine( pFoll->HasFollowFlowLine() );
delete pFoll;
SwFrm::DestroyFrm(pFoll);
Grow( nHeight );
}
@@ -3066,7 +3072,7 @@ void SwTabFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
while ( 0 != ( pLowerRow = static_cast<SwRowFrm*>(Lower()) ) && pLowerRow->IsRepeatedHeadline() )
{
pLowerRow->Cut();
delete pLowerRow;
SwFrm::DestroyFrm(pLowerRow);
}
// insert new headlines
@@ -3517,7 +3523,7 @@ SwRowFrm::SwRowFrm(const SwTableLine &rLine, SwFrm* pSib, bool bInsertContent)
}
}
SwRowFrm::~SwRowFrm()
void SwRowFrm::DestroyImpl()
{
SwModify* pMod = GetFmt();
if( pMod )
@@ -3526,6 +3532,12 @@ SwRowFrm::~SwRowFrm()
if( !pMod->HasWriterListeners() )
delete pMod; // and delete
}
SwLayoutFrm::DestroyImpl();
}
SwRowFrm::~SwRowFrm()
{
}
void SwRowFrm::RegistFlys( SwPageFrm *pPage )
@@ -4407,7 +4419,7 @@ SwCellFrm::SwCellFrm(const SwTableBox &rBox, SwFrm* pSib, bool bInsertContent)
}
}
SwCellFrm::~SwCellFrm()
void SwCellFrm::DestroyImpl()
{
SwModify* pMod = GetFmt();
if( pMod )
@@ -4425,6 +4437,12 @@ SwCellFrm::~SwCellFrm()
if( !pMod->HasWriterListeners() )
delete pMod; // and delete
}
SwLayoutFrm::DestroyImpl();
}
SwCellFrm::~SwCellFrm()
{
}
static bool lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, bool bInva )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 6be1b86..200a3fa 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -69,6 +69,7 @@ SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) :
mbInfFly ( false ),
mbInfFtn ( false ),
mbInfSct ( false )
, m_isInDestroy(false)
{
OSL_ENSURE( pMod, "No frame format given." );
mbInvalidR2L = mbInvalidVert = true;
@@ -654,7 +655,7 @@ void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct )
else
{
OSL_ENSURE( pSct->IsSctFrm(), "InsertGroup: For SectionFrms only" );
delete static_cast<SwSectionFrm*>(pSct);
SwFrm::DestroyFrm(static_cast<SwSectionFrm*>(pSct));
}
}
else
@@ -958,7 +959,7 @@ void SwCntntFrm::Cut()
pTmp->_InvalidatePrt();
}
pUp->Cut();
delete pUp;
SwFrm::DestroyFrm(pUp);
}
else
{
@@ -975,7 +976,7 @@ void SwCntntFrm::Cut()
else
{
pSct->DelEmpty( true );
delete pSct;
SwFrm::DestroyFrm(pSct);
}
}
}
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 9ccdf72..abec386 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -666,7 +666,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
}
pFoll->Cut();
SetFollow(pNxt);
delete pFoll;
SwFrm::DestroyFrm(pFoll);
return pNxt;
}
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index ca4b6e3..608b579 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -376,7 +376,7 @@ SwTxtFrm::SwTxtFrm(SwTxtNode * const pNode, SwFrm* pSib )
mnFrmType = FRM_TXT;
}
SwTxtFrm::~SwTxtFrm()
void SwTxtFrm::DestroyImpl()
{
// Remove associated SwParaPortion from pTxtCache
ClearPara();
@@ -406,6 +406,12 @@ SwTxtFrm::~SwTxtFrm()
++nPos;
}
}
SwCntntFrm::DestroyImpl();
}
SwTxtFrm::~SwTxtFrm()
{
}
const OUString& SwTxtFrm::GetTxt() const
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 5ccaa1f..0d3db11 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -482,7 +482,7 @@ void SwTxtFtn::DelFrms( const SwFrm* pSib )
{
SwFtnFrm *pFoll = pFtn->GetFollow();
pFtn->Cut();
delete pFtn;
SwFrm::DestroyFrm(pFtn);
pFtn = pFoll;
}
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 5fdaf05..c471908 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -126,7 +126,8 @@ void SwViewShell::Init( const SwViewOption *pNewOpt )
if( !mpLayout )
{
// switched to two step construction because creating the layout in SwRootFrm needs a valid pLayout set
mpLayout = SwRootFrmPtr(new SwRootFrm( mpDoc->GetDfltFrmFmt(), this ));
mpLayout = SwRootFrmPtr(new SwRootFrm(mpDoc->GetDfltFrmFmt(), this),
&SwFrm::DestroyFrm);
mpLayout->Init( mpDoc->GetDfltFrmFmt() );
}
}