Bug 161741 - LO crashes with undo/redo of new header + some other change
Summary: LO crashes with undo/redo of new header + some other change
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2 all versions
Hardware: All All
: high major
Assignee: Justin L
URL:
Whiteboard: target:25.2.0 target:24.8.2 target:24...
Keywords: haveBacktrace, implementationError
Depends on:
Blocks: Writer-Header-Footer Undo-Redo Crash
  Show dependency treegraph
 
Reported: 2024-06-22 13:36 UTC by Justin L
Modified: 2024-10-02 06:56 UTC (History)
5 users (show)

See Also:
Crash report or crash signature: ["SwUndoInsert::RedoImpl(sw::UndoRedoContext%20&)"]


Attachments
bt (5.46 KB, text/plain)
2024-06-28 10:13 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2024-06-22 13:36:48 UTC
Steps to reproduce the crash
- launch Writer
- Menu "Insert" -> Header and Footer -> Header -> Default Style
* enter "something" in the header
* use the undo dropdown to undo everything, including "Header/footer changed" (in one step) 
- Redo
=> crash

Notes: header or footer is irrelevant. The method of creating the header/footer is irrelevant (I used the in-header-area + button in testing).

The ability to undo/redo the "Header/footer change" started in
bibisect-linux-64-7.2 commit 910d9a081daf11ea53235d227c3dc9623942a824
commit 8d8486f43c1a8a51157bfc3e0b87090b05a9229e
Author: Daniel Arato (NISZ) on Mon Feb 22 16:59:38 2021 +0100
    tdf#46561 sw: fix lost undo stack setting header/footer

At first, (at least for these particular steps) undo/redo worked. Then for a short time the undo cleared the redo list, until the crash started with
bibisect-linux-64-7.2 commit 68d3f7ef5385a8c5717131fcd0f98e3fca9da825
commit 0cd000bb83719982c1fd2265ea040c82af5bf98e
Author: Daniel Arato (NISZ) on Mon Apr 26 15:04:17 2021 +0200
    tdf#141613 sw: avoid possible crash when undoing header creation
        We still need to call ClearRedo() because
        there is no mechanism in place to Redo a header/footer change.
Comment 1 Bogaboga Man 2024-06-22 15:29:43 UTC
I can confirm this bug.

Problem is that the crash report indicated to be at https://crashreport.libreoffice.org/stats/crash_details/8a4c3af4-eaf7-43e3-840f-86e475f355b8 is not available! I am using this environment: - 

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-GB
Calc: CL threaded
Comment 2 Xisco Faulí 2024-06-27 08:58:38 UTC
it's only happening when using the undo/redo buttons
Comment 3 Julien Nabet 2024-06-27 19:44:56 UTC
On pc Debian x86-64 with master sources updated today, I don't reproduce this.
Comment 4 Justin L 2024-06-27 23:09:09 UTC
(In reply to Xisco Faulí from comment #2)
> it's only happening when using the undo/redo buttons

Perhaps - but only because that is the easiest way to undo multiple actions in one step. The "redo" step can be achieved via Ctrl+Y or the menu and still cause the crash.

The key in reproducing is to undo both "typing: something" and "Header/footer change" in one step.
Comment 5 Julien Nabet 2024-06-28 10:13:49 UTC
Created attachment 195034 [details]
bt

On pc Debian x86-64 with master sources updated today, I could reproduce this.

I hadn't undone both actions in the same time.

I also noticed this log on console when undoing both actions:
warn:svl:529888:529888:svl/source/undo/undo.cxx:1084: SfxUndoManager::MarkTopUndoAction(): suspicious call!
Comment 6 Julien Nabet 2024-06-28 10:19:41 UTC
I noticed that if I undo the last action only (the "something" type), I can redo this.
But if I undo the last action, then the initial action (the header), I can't redo this.
Comment 7 BogdanB 2024-06-28 11:33:06 UTC Comment hidden (no-value)
Comment 8 Commit Notification 2024-08-16 07:03:41 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0a9da9e43c53406c867fe95cdd5c7192ce08bcb6

tdf#161741 tdf#161705 undo: delay ClearRedo until Undo finishes

It will be available in 25.2.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 Commit Notification 2024-08-17 02:37:08 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/86a5c48cdce4b8392ade2858d7835b48af8afc00

tdf#161741: LO crashed on redo of header changes: unit test

It will be available in 25.2.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 10 Justin L 2024-08-17 23:02:41 UTC
comment 8's patch should not be backported (unless an expert wants to take ownership of it). Changes to undo/redo code are fraught with unintended disaster.
Comment 11 Commit Notification 2024-09-05 06:22:23 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/ee0d856d921afc826ea8a48b82d489be7b45bc3d

tdf#161741 tdf#161705 pgnum wizard: avoid undo crash (sledgehammer)

It will be available in 24.8.2.

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 Justin L 2024-09-05 11:23:56 UTC
NOTE: The backport commits only handle the specific use of the page number wizard.
Comment 13 Commit Notification 2024-09-05 13:56:17 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/a438775c10f7098b0dd7ff3deaab10f1969fa566

tdf#161741 tdf#161705 pgnum wizard: avoid undo crash (sledgehammer)

It will be available in 24.2.7.

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 14 Commit Notification 2024-09-06 06:43:20 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/09df48f87f04b0176593cb5f649ac3cd2244891e

tdf#161741 undo nits: NeedsClearRedo is private + prioritize TopLevel

It will be available in 25.2.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.