sw/source/core/txtnode/modeltoviewhelper.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit accc0cdc1b417dbfdda687e310ba12cb096bcc90 Author: Miklos Vajna <[email protected]> AuthorDate: Mon Jan 5 08:49:57 2026 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Jan 5 10:00:56 2026 +0100 sw: fix crash in the ModelToViewHelper ctor gdb backtrace on the core file from the crash report: #5 0x0000000000afc0ee in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () #6 0x0000727cd30229b1 in std::deque<std::pair<sw::mark::Fieldmark const*, bool>, std::allocator<std::pair<sw::mark::Fieldmark const*, bool> > >::pop_back (this=0x7ffc1ea0f8e0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_deque.h:1597 #7 std::deque<std::pair<sw::mark::Fieldmark const*, bool>, std::allocator<std::pair<sw::mark::Fieldmark const*, bool> > >::pop_back (this=0x7ffc1ea0f8e0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_deque.h:1597 #8 ModelToViewHelper::ModelToViewHelper (this=this@entry=0x7ffc1ea0fb40, rNode=..., pLayout=0x631dce00, eMode=eMode@entry=(ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode | ExpandMode::HideFieldmarkCommands)) at sw/source/core/txtnode/modeltoviewhelper.cxx:207 #9 0x0000727cd311cea2 in SwXFlatParagraphIterator::getNextPara (this=0x64417ab0) at sw/source/core/unocore/unoflatpara.cxx:485 ... #12 0x0000727cd2c23b4f in SwDoc::StartGrammarChecking (this=<optimized out>, bSkipStart=bSkipStart@entry=false) at sw/source/core/doc/docnew.cxx:184 and: (gdb) frame 8 #8 ModelToViewHelper::ModelToViewHelper (this=this@entry=0x7ffc1ea0fb40, rNode=..., pLayout=0x631dce00, eMode=eMode@entry=(ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode | ExpandMode::HideFieldmarkCommands)) at sw/source/core/txtnode/modeltoviewhelper.cxx:207 207 startedFields.pop_back(); (gdb) print startedFields $2 = std::deque with 0 elements We have no reproducer for this, but seems the grammar checker is somehow invoked on an inconsistent model where the start and end field mark dummy characters are not balanced. Leave the assert in place, so possibly a later debug build can find a reproducer; but also check for this to avoid a crash in product builds. Change-Id: Ic9696e32bf344b336800bfa475f506e3cc103ef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196531 Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx index 7b33bb32baa8..2573d273e460 100644 --- a/sw/source/core/txtnode/modeltoviewhelper.cxx +++ b/sw/source/core/txtnode/modeltoviewhelper.cxx @@ -204,7 +204,10 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode, case CH_TXT_ATR_FIELDEND: { assert(startedFields.back().first == rIDMA.getFieldmarkAt(SwPosition(rNode, i))); - startedFields.pop_back(); + if (!startedFields.empty()) + { + startedFields.pop_back(); + } aHiddenMulti.Select({i, i}, true); break; }
