diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-02-12 22:11:37 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-02-13 00:25:05 +0100 |
commit | 657c500e2e9e9ad2e38e9da278b20fb82c109001 (patch) | |
tree | 3750b7503b18904787eb82d2d8dbaaa3a3ca78d5 /sw | |
parent | c0970c2be45ea62d86e24271065311aaa92c0186 (diff) |
fdo#41712: sw: fix crash in layout frame linked lists:
The pPrecede member is not maintained properly when setting the
corresponding pFollow member.
The change in SwTxtFrm::JoinFrm() fixes the crash, the other changes
are perhaps fixes for other crashes...
(regression from cc3d0d182cafef9649e45f4657233ac2221fdd0a)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/flowfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/frmform.cxx | 2 |
4 files changed, 24 insertions, 2 deletions
diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx index 25a7502ea7a3..32542e8b7ce9 100644 --- a/sw/source/core/inc/flowfrm.hxx +++ b/sw/source/core/inc/flowfrm.hxx @@ -145,6 +145,7 @@ protected: public: SwFlowFrm( SwFrm &rFrm ); + virtual ~SwFlowFrm(); const SwFrm *GetFrm() const { return &rThis; } SwFrm *GetFrm() { return &rThis; } diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 24f1b518e912..15c678e4fe5a 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -87,12 +87,33 @@ SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) : bFlyLock( false ) {} +SwFlowFrm::~SwFlowFrm() +{ + if (m_pFollow) + { + m_pFollow->m_pPrecede = 0; + } + if (m_pPrecede) + { + m_pPrecede->m_pFollow = 0; + } +} void SwFlowFrm::SetFollow(SwFlowFrm *const pFollow) { + if (m_pFollow) + { + assert(this == m_pFollow->m_pPrecede); + m_pFollow->m_pPrecede = 0; + } m_pFollow = pFollow; if (m_pFollow != NULL) { + if (m_pFollow->m_pPrecede) // re-chaining pFollow? + { + assert(m_pFollow == m_pFollow->m_pPrecede->m_pFollow); + m_pFollow->m_pPrecede->m_pFollow = 0; + } m_pFollow->m_pPrecede = this; } } diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 581c1239732f..4ff80e14fc93 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -222,7 +222,7 @@ void SwSectionFrm::DelEmpty( sal_Bool bRemove ) } else if( HasFollow() ) GetFollow()->bIsFollow = sal_False; - m_pFollow = NULL; + SetFollow(0); if( pUp ) { Frm().Height( 0 ); diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 1b3418725d37..0731b1021abf 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -680,8 +680,8 @@ SwCntntFrm *SwTxtFrm::JoinFrm() } } pFoll->Cut(); + SetFollow(pNxt); delete pFoll; - m_pFollow = pNxt; return pNxt; } |