Bug 123313

Summary: Undoing ToC insertion in middle of word causes assertion failure
Product: LibreOffice Reporter: Aron Budea <aron.budea>
Component: WriterAssignee: Michael Stahl (allotropia) <michael.stahl>
Status: VERIFIED FIXED    
Severity: normal CC: michael.stahl, raal, xiscofauli
Priority: medium Keywords: haveBacktrace
Version: 6.3.0.0.alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=123446
https://bugs.documentfoundation.org/show_bug.cgi?id=38703
Whiteboard: target:6.3.0 target:6.2.3 target:6.2.4
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 89606, 105537, 105948    
Attachments: Backtrace

Description Aron Budea 2019-02-11 00:35:09 UTC
Created attachment 149072 [details]
Backtrace

The following can only be reproduced with a debug build.

- Add a word to an empty document.
- Change its style to Heading 2.
- Position cursor somewhere in the middle of the word, and add Table of Contents (no need to change anything in the dialog).
- Undo the ToC insertion.

=> LibreOffice crashes with an assertion failure:

soffice.bin: /build/sources/libreoffice/sw/source/core/crsr/crossrefbookmark.cxx:58: virtual void sw::mark::CrossRefBookmark::SetMarkPos(const SwPosition&): Assertion `rNewPos.nContent.GetIndex() == 0 && "<sw::mark::CrossRefBookmark::SetMarkPos(..)>" " - new bookmark position for cross-reference bookmark doesn't mark start of text node"' failed.

Observed using LO 6.3.0.0.alpha0+ (17e5028044edef2b959b73ce1dbe2c9627d1a799) / Ubuntu 18.04.
Comment 1 Durgapriyanka 2019-02-13 16:46:39 UTC
Thank you for reporting the bug. I can confirm the bug present. LO crashes when TOC is undone.

Version: 6.3.0.0.alpha0+
Build ID: b6b28931435e44aca92b8c0e1659f701e3ed1a87
CPU threads: 2; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2019-01-30_06:57:04
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 2 Aron Budea 2019-02-13 17:49:52 UTC
(In reply to Durgapriyanka from comment #1)
> Thank you for reporting the bug. I can confirm the bug present. LO crashes
> when TOC is undone.
Thanks for checking! Is this a regular daily build? I did not get a crash after undoing in a non-debug build. If you can, please submit a crash report generated with 6.2.0.3.

However, I got a crash even in a release build after hitting undo and redo a couple of times, I'll open a separate bug report on that.
Comment 3 Commit Notification 2019-03-04 10:11:27 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/60ea01af8c57f9b03ee1da1196284fa10025c22c%5E%21

tdf#123313 sw: workaround Undo problem with ToX Update

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Michael Stahl (allotropia) 2019-03-04 10:13:15 UTC
was caused by cross-reference bookmarks; fixed on master
Comment 5 Commit Notification 2019-03-04 23:41:22 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/3e674fdca08b40bb18131c2490832647796d1301%5E%21

tdf#123313 sw: workaround Undo problem with ToX Update

It will be available in 6.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Michael Stahl (allotropia) 2019-04-25 16:12:41 UTC
not really fixed unfortunately, will upload new fixes to gerrit shortly...
Comment 7 Commit Notification 2019-04-26 13:56:31 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/eca4f30e430bf34dd52f7583f962860012933413%5E%21

tdf#123313 sw: towards fixing ToX Update Undo wrt. CrossReference

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2019-04-26 13:56:50 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/41df42a8dc758571dd7635c358a09bf412051649%5E%21

tdf#38703 i#42807 tdf#123313 sw: add Undo of ToX Update

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Michael Stahl (allotropia) 2019-04-26 13:58:59 UTC
as Zdenek Crhonek found, the previous commit only avoided the assert on Undo, but then Redo would still assert

fixed now on master

fixing basically required implementing the feature requested in bug 38703
Comment 10 Commit Notification 2019-04-27 13:35:18 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/ba9561220a2c87557416b7dcf95294bdf3d693ce%5E%21

tdf#123313 sw: towards fixing ToX Update Undo wrt. CrossReference

It will be available in 6.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2019-04-27 15:39:26 UTC
Zdeněk Crhonek committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/41f427f9b816061d985da31954fdf414b9a39a3d%5E%21

uitest for bug tdf#123313

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 BulkCheapAmmo 2019-07-08 09:35:16 UTC Comment hidden (spam)
Comment 13 BulkCheapAmmo 2019-07-08 09:38:03 UTC Comment hidden (spam)
Comment 14 Juvanta 2019-10-02 11:47:06 UTC Comment hidden (spam)
Comment 15 raal 2019-12-07 15:13:32 UTC
The test exist, set status to Verified.