sw/source/core/doc/DocumentStateManager.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit af81946e31376938031274086b3ca61b7abe391f Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed May 7 14:48:08 2025 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu May 8 14:44:36 2025 +0200 LOCRDT sw: fix bug when removing comment before start anchor Missing remove before insert. Change-Id: I7072456b96b3137380e27be1e62239b59ac30b23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185017 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx index da9e2e74ccd1..011c3c1e03e6 100644 --- a/sw/source/core/doc/DocumentStateManager.cxx +++ b/sw/source/core/doc/DocumentStateManager.cxx @@ -832,6 +832,7 @@ void DocumentStateManager::YrsAddComment(SwPosition const& rPos, assert(pComment); ::std::unique_ptr<YOutput, YOutputDeleter> const pPos{yarray_get(pComment->value.y_type, pTxn, 0)}; assert(pPos); + assert(yarray_len(pPos->value.y_type) == 4); ::std::unique_ptr<YOutput, YOutputDeleter> const pPosN{yarray_get(pPos->value.y_type, pTxn, 2)}; ::std::unique_ptr<YOutput, YOutputDeleter> const pPosC{yarray_get(pPos->value.y_type, pTxn, 3)}; // SwTextNode::Update already moved pMark @@ -939,11 +940,13 @@ void DocumentStateManager::YrsRemoveComment(SwPosition const& rPos, OString cons assert(pComment); ::std::unique_ptr<YOutput, YOutputDeleter> const pPos{yarray_get(pComment->value.y_type, pTxn, 0)}; assert(pPos); + assert(yarray_len(pPos->value.y_type) == 4); ::std::unique_ptr<YOutput, YOutputDeleter> const pPosN{yarray_get(pPos->value.y_type, pTxn, 2)}; ::std::unique_ptr<YOutput, YOutputDeleter> const pPosC{yarray_get(pPos->value.y_type, pTxn, 3)}; // SwTextNode::Update will move pMark soon assert(pPosN->value.integer == pMark->GetMarkStart().GetNodeIndex().get()); assert(pPosC->value.integer == pMark->GetMarkStart().GetContentIndex()); + yarray_remove_range(pPos->value.y_type, pTxn, 2, 2); YInput const anchorStartNode{yinput_long(pMark->GetMarkStart().GetNodeIndex().get())}; YInput const anchorStartContent{yinput_long(pMark->GetMarkStart().GetContentIndex() - 1)}; YInput posArray[]{anchorStartNode, anchorStartContent};