summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/swtable.hxx1
-rw-r--r--sw/source/core/table/swtable.cxx14
-rw-r--r--sw/source/core/undo/untbl.cxx5
3 files changed, 17 insertions, 3 deletions
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 29c779a51ed2..a3525882c142 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -424,2 +424,3 @@ public:
+ void RemoveFromTable();
const SwStartNode *GetSttNd() const { return pSttNd; }
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 3a57a7586b4f..69e755b09a70 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1749,6 +1749,5 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwStartNode& rSttNd, SwTableL
-SwTableBox::~SwTableBox()
+void SwTableBox::RemoveFromTable()
{
- // Inhaltstragende Box ?
- if( !GetFrmFmt()->GetDoc()->IsInDtor() && pSttNd )
+ if (pSttNd) // box containing contents?
{
@@ -1761,2 +1760,11 @@ SwTableBox::~SwTableBox()
rSrtArr.Remove( p ); // austragen
+ pSttNd = 0; // clear it so this is only run once
+ }
+}
+
+SwTableBox::~SwTableBox()
+{
+ if (!GetFrmFmt()->GetDoc()->IsInDtor())
+ {
+ RemoveFromTable();
}
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 11dbb4b7eeaa..e3a6af5d7a6a 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1757,3 +1757,7 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
else
+ { // first disconnect box from node, otherwise ~SwTableBox would
+ // access pBox->pSttNd, deleted by DeleteSection
+ pBox->RemoveFromTable();
rDoc.DeleteSection( rDoc.GetNodes()[ nIdx ] );
+ }
aDelBoxes.insert( aDelBoxes.end(), pBox );
@@ -1773,2 +1777,3 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
pPCD->DeleteBox( &pTblNd->GetTable(), *pBox );
+ pBox->RemoveFromTable(); // ~SwTableBox would access pBox->pSttNd
aDelBoxes.insert( aDelBoxes.end(), pBox );