Bug 163033 - Crash when attempting to save a COPY of a sheet-with-comments from a now-closed spreadsheet
Summary: Crash when attempting to save a COPY of a sheet-with-comments from a now-clos...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.0.2 rc
Hardware: All All
: high critical
Assignee: Justin L
URL:
Whiteboard: target:25.8.0 target:25.2.0.0.beta2
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Cut-Copy
  Show dependency treegraph
 
Reported: 2024-09-18 21:07 UTC by Jelle Geerts
Modified: 2024-12-16 21:50 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
163033_comment.ods: simple spreadsheet containing just one comment (8.02 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-12-13 00:15 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jelle Geerts 2024-09-18 21:07:25 UTC
Description:
This crash occurs if we open a spreadsheet file and make an untitled copy of it, then close the original document. Once the AutoRecovery timer elapses, LibreOffice attempts to save the AutoRecovery information and crashes.

This crash only seems to occur in certain cases, like when the original sheet contained cells with comments. There may be other such cases.

It leads to data loss however, since the untitled document cannot be recovered.

The crash does not seem to occur in version 7.4.7.2 (happens to be another version I had available in a Debian 12 VM).

The 24.2.4.2 version that this bug is filed against was tested on a Fedora 40 system.

Steps to Reproduce:
1. (optional) Set the AutoRecovery timer to 1 minute.

2. Close LibreOffice.

3. Start LibreOffice.

4. Create an empty spreadsheet.

5. Add a comment to some cell, like cell C7.

6. Save the spreadsheet to a file, like 'example.ods'.

7. Close LibreOffice.

8. Start LibreOffice from the file manager, by opening the 'example.ods' file.

9. Right-click the first sheet in the spreadsheet, and select 'Move or Copy Sheet...'

10. Select 'Copy', choose '- new document -' as the target and click 'Copy'.

11. Now close the original document, so you only have the untitled copy open.

12. Wait for the AutoRecovery timer which will attempt save the AutoRecovery information and cause LibreOffice to crash in this case.

Actual Results:
LibreOffice crashes after N minutes (N = the AutoRecovery timer setting) and shows the Document Recovery dialog which informs you that the 'Untitled 1' document can be recovered. But the next time you launch LibreOffice, there's no recovered document at all.

Expected Results:
Most importantly: LibreOffice should NOT crash.

And optionally: LibreOffice should indeed be able to recover the untitled document if it informs the user that it can recover it.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 24.2.4.2 (X86_64)
Build ID: 420(Build:2)
CPU threads: 12; OS: Linux 6.9; UI render: default; VCL: gtk3
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 1 Buovjaga 2024-12-03 17:56:52 UTC
I reproduce.

Arch Linux 64-bit
Version: 24.8.3.2 (X86_64) / LibreOffice Community
Build ID: 480(Build:2)
CPU threads: 8; OS: Linux 6.11; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
24.8.3-1
Calc: threaded
Comment 2 Justin L 2024-12-13 00:15:03 UTC
Created attachment 198096 [details]
163033_comment.ods: simple spreadsheet containing just one comment

Note that the recovery dialog is the one that occurs AT THE TIME OF THE CRASH and not at startup. So I assume this is saying that it will TRY to create a recovery, but that it crashes (again) when trying to save (so obviously there can be nothing to recover).

Simplified steps
1.) open 163033_comment.ods
2.) Right-click  Sheet1 tab at the bottom, and select 'Move or Copy Sheet...'
3. Select 'Copy', choose '- new document -' as the target and click 'Copy'.
4. Now close the original document, so you only have the untitled copy open.
5. Save the document. <crash>

This started in 24.2 with commit ade2565cc2b2e5e8cf35fe828bf85649f7ff593a
Author: Czeber László Ádám on Fri Jun 30 12:24:53 2023 +0200
    tdf#117307 sc: Comments are duplicated after Row delete and Undo
Comment 3 Justin L 2024-12-13 01:08:56 UTC
Proposed fix at https://gerrit.libreoffice.org/c/core/+/178394
Comment 4 Justin L 2024-12-13 01:41:11 UTC
The regression commit was backported to 7.6.0.2.
Comment 5 Commit Notification 2024-12-13 12:31:30 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6edc10c6b0b8322db63230b3a71e393437cbb7ac

tdf#163033 sc: fix crash when copying comment to another ScDocument

It will be available in 25.8.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 6 Commit Notification 2024-12-16 08:42:14 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/6a24783fadcd72ef2913bb8d118d753a8350a599

tdf#163033 sc: fix crash when copying comment to another ScDocument

It will be available in 25.2.0.0.beta2.

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.