summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-18 16:50:03 +0100
committerMichael Stahl <mstahl@redhat.com>2011-11-18 22:24:20 +0100
commit6c1ac01a4ac425456cb14e4ba34a3a2d9286453b (patch)
tree48af256ae65471e402e026b56499b3fd12e48b5f /sw
parent9de2110e5bed17fcc6050bfaa669df45f0c1eb44 (diff)
fdo#42534: SwRootFrm: clear SwLayouter in dtor
This crash is probably a regression introduced by CWS swlayoutrefactoring.
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/doc.hxx1
-rw-r--r--sw/source/core/doc/doc.cxx11
-rw-r--r--sw/source/core/layout/newfrm.cxx9
3 files changed, 18 insertions, 3 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8427b172e9d4..52991c192d88 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -949,6 +949,7 @@ public:
virtual const SwRootFrm *GetCurrentLayout() const;
virtual SwRootFrm *GetCurrentLayout();//swmod 080219
virtual bool HasLayout() const;
+ void ClearSwLayouterEntries();
/** IDocumentTimerAccess
*/
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 326cfdec4e02..d4929bb853a8 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1815,13 +1815,22 @@ bool SwDoc::IsModified() const
return mbModified;
}
-void SwDoc::SetModified()
+//Load document from fdo#42534 under valgrind, drag the scrollbar down so full
+//document layout is triggered. Close document before layout has completed, and
+//SwAnchoredObject objects deleted by the deletion of layout remain referenced
+//by the SwLayouter
+void SwDoc::ClearSwLayouterEntries()
{
SwLayouter::ClearMovedFwdFrms( *this );
SwLayouter::ClearObjsTmpConsiderWrapInfluence( *this );
SwLayouter::ClearFrmsNotToWrap( *this );
// #i65250#
SwLayouter::ClearMoveBwdLayoutInfo( *this );
+}
+
+void SwDoc::SetModified()
+{
+ ClearSwLayouterEntries();
// We return the status for the link according to the old and new value of the flags
// Bit 0: -> old state
// Bit 1: -> new state
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 4504e6ea61fa..9c7c5af77ca7 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -616,8 +616,13 @@ SwRootFrm::~SwRootFrm()
if(pBlink)
pBlink->FrmDelete( this );
- if ( static_cast<SwFrmFmt*>(GetRegisteredInNonConst()) )
- static_cast<SwFrmFmt*>(GetRegisteredInNonConst())->GetDoc()->DelFrmFmt( static_cast<SwFrmFmt*>(GetRegisteredInNonConst()) );
+ SwFrmFmt *pRegisteredInNonConst = static_cast<SwFrmFmt*>(GetRegisteredInNonConst());
+ if ( pRegisteredInNonConst )
+ {
+ SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
+ pDoc->DelFrmFmt( pRegisteredInNonConst );
+ pDoc->ClearSwLayouterEntries();
+ }
delete pDestroy;
pDestroy = 0;