sw/inc/ndindex.hxx | 8 ++++---- sw/qa/extras/uiwriter/uiwriter4.cxx | 2 +- sw/source/core/doc/DocumentRedlineManager.cxx | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-)
New commits: commit 2d9e35063c81e22ef681be0aa39eb3311f00784a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Mar 12 11:43:16 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Mar 12 12:55:08 2023 +0000 Assert that we only order nodes of the same array Change-Id: Id04aa8177552624078369d33c9e7bcdc783045bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148722 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index bbe76f1be706..04848f00479e 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -96,10 +96,10 @@ public: bool operator==( SwNodeOffset nOther ) const { return GetIndex() == nOther; } bool operator!=( SwNodeOffset nOther ) const { return GetIndex() != nOther; } - bool operator<( const SwNode& rNd ) const { return operator<(rNd.GetIndex()); } - bool operator<=( const SwNode& rNd ) const { return operator<=(rNd.GetIndex()); } - bool operator>( const SwNode& rNd ) const { return operator>(rNd.GetIndex()); } - bool operator>=( const SwNode& rNd ) const { return operator>=(rNd.GetIndex()); } + bool operator<( const SwNode& rNd ) const { assert(&GetNodes() == &rNd.GetNodes()); return operator<(rNd.GetIndex()); } + bool operator<=( const SwNode& rNd ) const { return operator==(rNd) || operator<(rNd); } + bool operator>( const SwNode& rNd ) const { assert(&GetNodes() == &rNd.GetNodes()); return operator>(rNd.GetIndex()); } + bool operator>=( const SwNode& rNd ) const { return operator==(rNd) || operator>(rNd); } bool operator==( const SwNode& rNd ) const { return m_pNode == &rNd; } bool operator!=( const SwNode& rNd ) const { return m_pNode != &rNd; } diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 8771d5d15fe2..d8e24dfc6f9d 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -1480,7 +1480,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf95699) pMarkAccess = aClipboard.getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); ::sw::mark::IFieldmark* pFieldMark - = pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras()), false); + = pMarkAccess->getFieldmarkAfter(SwPosition(aClipboard.GetNodes().GetEndOfExtras()), false); CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), pFieldMark->GetFieldname()); } diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index e3ab6bed2c09..4e9176cc340a 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1210,6 +1210,9 @@ SwExtraRedlineTable& DocumentRedlineManager::GetExtraRedlineTable() bool DocumentRedlineManager::IsInRedlines(const SwNode & rNode) const { + if (&rNode.GetNodes() != &m_rDoc.GetNodes()) + return false; + SwPosition aPos(rNode); SwNode & rEndOfRedlines = m_rDoc.GetNodes().GetEndOfRedlines(); SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),