summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/core/data/ww8/pass/crash-4.docbin0 -> 34304 bytes
-rw-r--r--sw/source/filter/ww8/ww8par.cxx17
-rw-r--r--sw/source/filter/ww8/ww8par.hxx13
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx2
4 files changed, 20 insertions, 12 deletions
diff --git a/sw/qa/core/data/ww8/pass/crash-4.doc b/sw/qa/core/data/ww8/pass/crash-4.doc
new file mode 100644
index 000000000000..8658e0eeab2e
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/crash-4.doc
Binary files differ
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d6a25ccec401..1142325a4e93 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4632,9 +4632,8 @@ void wwSectionManager::InsertSegments()
void wwExtraneousParas::delete_all_from_doc()
{
- typedef std::vector<SwTextNode*>::iterator myParaIter;
- myParaIter aEnd = m_aTextNodes.end();
- for (myParaIter aI = m_aTextNodes.begin(); aI != aEnd; ++aI)
+ auto aEnd = m_aTextNodes.rend();
+ for (auto aI = m_aTextNodes.rbegin(); aI != aEnd; ++aI)
{
SwTextNode *pTextNode = *aI;
SwNodeIndex aIdx(*pTextNode);
@@ -5357,6 +5356,12 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
DELETEZ( m_pLstManager );
}
+ SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table ending");
+ m_pTableEndPaM.reset(); //ensure this is deleted before pPaM
+ mpCrsr.reset();
+ m_pPaM = nullptr;
+ m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
+
// remove extra paragraphs after attribute ctrl
// stacks etc. are destroyed, and before fields
// are updated
@@ -5368,12 +5373,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
if (m_bNewDoc)
m_rDoc.getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( eMode ));
- SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table ending");
- m_pTableEndPaM.reset(); //ensure this is deleted before pPaM
- mpCrsr.reset();
- m_pPaM = nullptr;
- m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
-
UpdatePageDescs(m_rDoc, nPageDescOffset);
return nErrRet;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index a0d7202e049b..7187bfe1e6a7 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -49,6 +49,7 @@
#include <fmtfsize.hxx>
#include <fmtornt.hxx>
#include <fmtsrnd.hxx>
+#include <ndtxt.hxx>
#include <editeng/lrspitem.hxx>
#include <oox/ole/olehelper.hxx>
@@ -453,6 +454,14 @@ namespace SwWW8
return r1.compareToIgnoreAsciiCase(r2)<0;
}
};
+
+ struct ltnode
+ {
+ bool operator()(const SwTextNode *r1, const SwTextNode *r2) const
+ {
+ return r1->GetIndex() < r2->GetIndex();
+ }
+ };
};
class SwWW8ReferencedFltEndStack : public SwFltEndStack
@@ -920,12 +929,12 @@ private:
/*
A vector of SwTextNodes to erase from a document after import is complete
*/
- std::vector<SwTextNode*> m_aTextNodes;
+ std::set<SwTextNode*, SwWW8::ltnode> m_aTextNodes;
SwDoc& m_rDoc;
public:
explicit wwExtraneousParas(SwDoc &rDoc) : m_rDoc(rDoc) {}
~wwExtraneousParas() { delete_all_from_doc(); }
- void push_back(SwTextNode *pTextNode) { m_aTextNodes.push_back(pTextNode); }
+ void insert(SwTextNode *pTextNode) { m_aTextNodes.insert(pTextNode); }
void delete_all_from_doc();
};
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e36633a58f06..fc54c76c7cb7 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2220,7 +2220,7 @@ SwTwips SwWW8ImplReader::MoveOutsideFly(SwFrameFormat *pFlyFormat,
//delete after import is complete rather than now
//to avoid the complication of managing uncommitted
//ctrlstack properties that refer to it.
- m_aExtraneousParas.push_back(pNd);
+ m_aExtraneousParas.insert(pNd);
SwTable& rTable = pTable->GetTable();
SwFrameFormat* pTableFormat = rTable.GetFrameFormat();