Bug 123313 - Undoing ToC insertion in middle of word causes assertion failure
Summary: Undoing ToC insertion in middle of word causes assertion failure
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:6.3.0 target:6.2.3 target:6.2.4
Keywords: haveBacktrace
Depends on:
Blocks: TableofContents-Indexes Crash-Assert Undo-Redo
  Show dependency treegraph
 
Reported: 2019-02-11 00:35 UTC by Aron Budea
Modified: 2019-12-07 15:13 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Backtrace (28.99 KB, text/plain)
2019-02-11 00:35 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
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.