Bug 162095 - Redo after Undo after page number addition leads to crash in SwNodeIndex::SwNodeIndex(SwNode *) / SwPosition::SwPosition()
Summary: Redo after Undo after page number addition leads to crash in SwNodeIndex::SwN...
Status: RESOLVED DUPLICATE of bug 161705
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2024-07-19 00:55 UTC by tobias
Modified: 2024-07-23 02:31 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["SwNodeIndex::SwNodeIndex(SwNode *)","SwPosition::SwPosition(SwNode const&, o3tl::strong_int<int, Tag_SwNodeOffset>)"]


Attachments
Bug reproduction 24.2.3.2 (Webm with VP9 and Opus) (4.96 MB, video/webm)
2024-07-19 03:33 UTC, tobias
Details
Bug reproduction 24.2.5.2 (Webm with VP9 and Opus) (9.84 MB, video/webm)
2024-07-19 03:47 UTC, tobias
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tobias 2024-07-19 00:55:48 UTC
This bug was filed from the crash reporting server and is br-3a8b86ee-7965-4247-a2a4-5217222b3c04.
=========================================

I hit "Ctrl+Z" (Undo) after adding "i / ii" page numbers at the bottom right of the pages.
Comment 1 Stéphane Guillou (stragu) 2024-07-19 02:04:01 UTC
Not reproduced in own trunk build:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e9a37656b75b4ce82b3e48af727f03f386e64a08
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Not in most recent 24.2 version either:

Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3

Not on Windows either:

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 4; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win

Can you please provide mode detailed steps? Does it happen from a new document with a single page? Or does it happen for a specific document - which you might be able to attach?
Comment 2 tobias 2024-07-19 03:14:46 UTC
Reproduced,

https://crashreport.libreoffice.org/stats/crash_details/47418c1e-32ee-46da-a2b5-56326aab0370

although the Undo isn't the issue. The following Redo is.

Create a document that has only one page, but is filled so much that adding page numbers will create a second one.

Add page numbers, and the option for "mirroring on even page numbers" is notably grayed out / inaccessible due to the document having only one page.

Create page numbers on the right bottom of the document, "i, ii" style.

Click the page number so you're editing that area of the page.

Ctrl+Z (Undo). Page numbers disappear, document is back to one page.

Ctrl+Y (Redo). Crash.
Comment 3 tobias 2024-07-19 03:33:12 UTC
Created attachment 195384 [details]
Bug reproduction 24.2.3.2 (Webm with VP9 and Opus)

https://crashreport.libreoffice.org/stats/crash_details/9d91f04a-3df4-4bff-99e8-8a1c304b8473

I will now upgrade LibreOffice using LibreOffice_24.2.5_Win_x86-64.msi
Comment 4 tobias 2024-07-19 03:47:49 UTC
Created attachment 195385 [details]
Bug reproduction 24.2.5.2 (Webm with VP9 and Opus)

Reproduced using 24.2.5.2 on Windows 10.0.26120, amd64 family 6 model 191 stepping 2

https://crashreport.libreoffice.org/stats/crash_details/7123d794-6a28-414d-953c-9f8e591e1e35

This is immediately after the upgrade from 24.2.3.2 (you can see my task bar shortcut having been broken by the update in the video).
Comment 5 Stéphane Guillou (stragu) 2024-07-19 05:24:53 UTC
No need to change position and typo of page number, I can reproduce with the defaults:

1. New Writer document
2. Insert > Page number > OK
3. Undo
4. Redo

Reproduced in:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: bbd5079c58e352ece8f10328f8dcda9819c4cfbe
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3

Version: 24.8.0.1 (X86_64) / LibreOffice Community
Build ID: 6fd6cae02baed1e82d14ed2da1f2458092354dab

Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
https://crashreport.libreoffice.org/stats/crash_details/b24eacf1-3678-416a-a3c5-e3fd38bf74ed

Version: 7.6.7.2 (X86_64) / LibreOffice Community
Build ID: dd47e4b30cb7dab30588d6c79c651f218165e3c5
https://crashreport.libreoffice.org/stats/crash_details/ff9a24b4-f751-4e86-a162-74a8d62c0679

Page number dialog was added in 7.6.
Justin, what do you think?
Comment 6 tobias 2024-07-19 07:14:46 UTC
(I was unsure whether to submit the crash report and whether to create an account and a formal bug report when I encountered this. So I'd like to take a moment to note that the entire situation and process – one simple button to send a usable report after a crash, one simple "Writer" link on the resulting page, a human trying to help an hour later in the middle of the night and successfully reproducing the issue as soon as it was properly described, identifying the version the feature was added in and starting collaboration on the bugfix – is far, far beyond what I have experienced in any other open source project and beyond even high expectations one could have optimistically had. Especially given that the reported bug was first not reproducible and may have seemed like a user-specific issue with an old version (!!), if I can thank you somehow, I'd like to do so. I guess donating to the Document Foundation is at least something I can do even if it doesn't directly reach the amazing people doing this work.)
Comment 7 Stéphane Guillou (stragu) 2024-07-19 07:51:26 UTC
(In reply to tobias from comment #6)
Thank you very much for the kind words! You contribution in reporting issues and providing enough details to reproduce them is already greatly appreciated and helpful. From the crash report you shared, looks like hundreds of users are experiencing a similar crash, so having a report with steps to reproduce the issue is the first, massive step in getting it fixed for everyone.
Of course, donations to TDF also are, but there are many more ideas that don't involve money: https://www.libreoffice.org/community/get-involved

(In reply to Stéphane Guillou (stragu) from comment #5)
> Page number dialog was added in 7.6.
I assumed this was an "implementation error" but I actually bibisected the crash with the linux-64-7.6 repo to first bad build [591792d53e89189b23bc3eb64bf6d64c6a4153f4] which is d272ab078b401bf4d70919680f2aa18ddbb15c6a, a cherrypick of:

commit 57974af130e7421da6b07589d4a63a754b757ad6
author	Michael Stahl	Thu Nov 23 20:45:09 2023 +0100
committer	Michael Stahl Fri Nov 24 10:23:51 2023 +0100
tdf#148389 sw: fix Delete Undo/Redo of bookmark positions
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159875

Michael, can you please have a look?
Comment 8 Justin L 2024-07-19 11:59:28 UTC

*** This bug has been marked as a duplicate of bug 161705 ***
Comment 9 Justin L 2024-07-19 14:27:36 UTC
A sledgehammer fix for this is https://gerrit.libreoffice.org/c/core/+/170771