Bug 166713 - Crash when editing paragraph after toggling outline folding
Summary: Crash when editing paragraph after toggling outline folding
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks: Writer-Outline-Folding
  Show dependency treegraph
 
Reported: 2025-05-24 22:01 UTC by correctmost
Modified: 2025-07-08 10:36 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["SwCursorShell::GotoOutline(unsigned __int64)"]


Attachments
Try of mine on the bug (26.11 KB, image/png)
2025-05-25 07:43 UTC, Faisal Iqbal
Details
sample doc (7.84 KB, application/vnd.oasis.opendocument.text)
2025-05-25 08:11 UTC, correctmost
Details

Note You need to log in before you can comment on or make changes to this bug.
Description correctmost 2025-05-24 22:01:50 UTC
Steps to reproduce:
- Create a new Writer document
- Format > Paragraph > Outline & List
- Set "Outline level" to Level 1
- Press OK
- Click on the green arrow to toggle outline folding
- Press enter to trigger a crash

---

Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 8; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
25.2.3-3
Calc: threaded

Arch Linux package: libreoffice-fresh 25.2.3-3
Comment 1 Faisal Iqbal 2025-05-25 07:43:35 UTC
Created attachment 200949 [details]
Try of mine on the bug
Comment 2 Faisal Iqbal 2025-05-25 07:47:36 UTC
Tested on: Kali Linux Rolling 2025.1
LibreOffice: 25.2.2.2, 520(Build:2)
CPU: intel CORE i5, 4th gen.

Followed the exact steps:

Created a new Writer document

Set paragraph Outline Level to 1

Enabled outline folding using the arrow

Pressed Enter

Result: NOT REPRODUCIBLE — LibreOffice did not crash. It just showed the intended behavior.
Comment 3 correctmost 2025-05-25 08:11:36 UTC
Created attachment 200951 [details]
sample doc

Steps to reproduce:
- Open the attachment
- Press enter to trigger a crash

Your screenshot shows text that was not specified in the steps to reproduce.  You also seem to be testing with a slightly older version.
Comment 4 Julien Nabet 2025-05-25 08:52:50 UTC
Sorry, what do you mean with the "green arrow"?
Comment 5 correctmost 2025-05-25 09:10:48 UTC
After you set the outline level and press OK, try hovering the mouse cursor over the first line of the document.  That should reveal an arrow in the left margin that allows you to toggle outline folding.  (The arrow is visible next to the "2" bullet in attachment #200949 [details], though it doesn't appear to be green on that system.)

It's possible I manually enabled Outline Folding in the past.  I see a checkbox for "Show outline-folding buttons" in the LibreOffice Writer > View options tab.

If the initial steps do not work, hopefully you can just download attachment 200951 [details] and press enter to trigger the crash.
Comment 6 Julien Nabet 2025-05-25 09:18:16 UTC
Thank you for the quick feedback, I could reproduce this on pc Debian x86-64 with master sources updated today.

Here's the relevant part of bt:
#5  0x00007f089a4a30c3 in std::__debug::vector<SwNode*, std::allocator<SwNode*> >::operator[] (this=0x5654dc8a3948, __n=1) at /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/debug/vector:517
#6  0x00007f089a491ead in o3tl::sorted_vector<SwNode*, CompareSwOutlineNodes, o3tl::find_unique>::operator[] (this=0x5654dc8a3948, index=1) at include/o3tl/sorted_vector.hxx:198
#7  0x00007f089a482a46 in SwCursorShell::GotoOutline (this=0x5654d85356a0, nIdx=1) at /home/julien/lo/libreoffice/sw/source/core/crsr/crstrvl.cxx:1184
#8  0x00007f089be4b15a in SwWrtShell::GotoOutline (this=0x5654d85356a0, nIdx=1) at /home/julien/lo/libreoffice/sw/source/uibase/wrtsh/move.cxx:658
#9  0x00007f089be5ecd4 in lcl_FoldedOutlineNodeEndOfParaSplit (pThis=0x5654d85356a0) at /home/julien/lo/libreoffice/sw/source/uibase/wrtsh/wrtsh1.cxx:1348
#10 0x00007f089be5e4e1 in SwWrtShell::SplitNode (this=0x5654d85356a0, bAutoFormat=true) at /home/julien/lo/libreoffice/sw/source/uibase/wrtsh/wrtsh1.cxx:1386
#11 0x00007f089b99319e in SwEditWin::KeyInput (this=0x5654d8071e40, rKEvt=...) at /home/julien/lo/libreoffice/sw/source/uibase/docvw/edtwin.cxx:2810
#12 0x00007f08d62563e4 in ImplHandleKey (pWindow=0x5654d80cb520, nSVEvent=NotifyEventType::KEYINPUT, nKeyCode=1280, nCharCode=0, nRepeat=0, bForward=true)
    at /home/julien/lo/libreoffice/vcl/source/window/winproc.cxx:1209
#13 0x00007f08d625486a in ImplWindowFrameProc (_pWindow=0x5654d80cb520, nEvent=SalEvent::KeyInput, pEvent=0x7ffe8a004462) at /home/julien/lo/libreoffice/vcl/source/window/winproc.cxx:2722
Comment 7 Julien Nabet 2025-05-25 10:05:36 UTC
searching a bit in gdb, at line 1347, Seek_Entry makes nPos = 1 but returns false because pNd hasn't been found.


diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 3797ed4bcabe..63247b07bb53 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1344,8 +1344,8 @@ static bool lcl_FoldedOutlineNodeEndOfParaSplit(SwWrtShell *pThis)
 
             SwTextNode* pNd = pDoc->GetNodes().MakeTextNode(*pEndNd, pTextNode->GetTextColl(), true);
 
-            (void) rOutlineNodes.Seek_Entry(pNd, &nPos);
-            pThis->GotoOutline(nPos);
+            if (rOutlineNodes.Seek_Entry(pNd, &nPos))
+                pThis->GotoOutline(nPos);
 
             if (pDoc->GetIDocumentUndoRedo().DoesUndo())
             {

prevents LO from crashing but typing Enter makes nothing instead so don't think it's the right solution.
Comment 8 Xisco Faulí 2025-07-08 10:36:52 UTC
@Jim, since you added support for Outline View layout, I thought you might be interested in this issue