Bug 158089 - Crash when using undo command while using macros
Summary: Crash when using undo command while using macros
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks: Undo-Redo Crash
  Show dependency treegraph
 
Reported: 2023-11-06 14:06 UTC by perko.jernej
Modified: 2024-04-16 02:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature: ["ScDocShell::PostPaint(ScRangeList const&, PaintPartFlags, unsigned short)"]


Attachments
Simple file that can be used to observe mentioned problem. (75.76 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-11-06 14:12 UTC, perko.jernej
Details
bt with debug symbols (9.12 KB, text/plain)
2023-11-08 12:36 UTC, Julien Nabet
Details
Valgrind trace (237.57 KB, text/x-log)
2023-11-08 15:19 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description perko.jernej 2023-11-06 14:06:41 UTC
Description:
When opening my file "Problem with macros 1.ods" (attached to this bug) and try to use undo command (either by Ctrl+Z or by pressing the icon for unduing) application crashes and doesn't state what might had gone wrong. After restarting it tries to restore broken file after the change has already been made and doesn't show prior state of file.

Steps to Reproduce:
1. Open file "Problem with macros 1.ods"
2. Enable macros at prompt (not enabled by default)
- in settings for macro safety I have ticket box at middle security (Before enabling macro from unknown source, prompt the user)
3. On page "List" or on page "Images" make any edit in any or multiple cells
- note that page "Images" must be unlocked prior to applying changes, but is not necessary when editing page "List"
4. Press button to undo change (Ctrl+Z or by pressing icon to undo)

Actual Results:
When applying step 4, application crashes without evident reason.

Expected Results:
I expect that the cell or multiple cells modified be restored to previos state, before editing.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Note that my system is set to slovene language so some messages writen might differ from when displayed in english.
Note that this only happens on pages that have macros in it. Page "Instructions" isn't affected by this bug.
Comment 1 perko.jernej 2023-11-06 14:12:10 UTC
Created attachment 190683 [details]
Simple file that can be used to observe mentioned problem.
Comment 2 perko.jernej 2023-11-06 14:22:04 UTC
I've noticed that when I attempted to restore a crashed file, it was restored to the state after editing the cell(s).

Furthermore, when I tried to delete the restored crashed file, I encountered an issue. It displayed a message saying, 'File is being used by the LibreOffice program.' I checked the task manager and found that after each crash, LibreOffice was not properly closed and was still running in the background, which caused it to claim ownership over the file. Only after I manually closed all LibreOffice applications was I able to delete files from the drive without any issues.
Comment 3 Stéphane Guillou (stragu) 2023-11-07 11:16:25 UTC
Thank you for the report!

Reproduced in 7.6:

Version: 7.6.3.1 (X86_64) / LibreOffice Community
Build ID: c4af5b1259bceea6e979e6fe2435dbee7a5a87c2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Also in 7.5: https://crashreport.libreoffice.org/stats/crash_details/e6880e38-bc8b-4c3e-a618-b2c9d10c2b78
Version: 7.5.8.2 (X86_64) / LibreOffice Community
Build ID: f718d63693263970429a68f568db6046aaa9df01
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

And 7.4 too: https://crashreport.libreoffice.org/stats/crash_details/39601237-be0e-4b4e-9c47-3bfae77a814c
Version: 7.4.7.2 / LibreOffice Community
Build ID: 723314e595e8007d3cf785c16538505a1c878ca5
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

6.0.0.3: https://crashreport.libreoffice.org/stats/crash_details/aef85757-a8a6-4136-8e63-f2e7f58f7df6

In recent master build, there are more undo steps recorded in the history, but undoing the last one does not crash it. Undoing the whole history does crash it.
Comment 4 Julien Nabet 2023-11-08 12:36:17 UTC
Created attachment 190725 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 5 Julien Nabet 2023-11-08 15:19:43 UTC
Created attachment 190727 [details]
Valgrind trace
Comment 6 Matt K 2024-02-07 01:59:27 UTC
In latest master, the example file crashes for me when I try to load the document (sometimes it requires high CPU load, sometimes it just crashes without much CPU load), so it is not so easy to debug.

Perko, can you please try to delete some of the macros and see if it reproduces, maybe you can isolate where the problem is that way.  Please provide a sample document with a smaller set of macros.
Comment 7 Matt K 2024-02-07 03:22:10 UTC
I tried to bibisect the bug using https://bibisect.libreoffice.org/win32-5.3, but the bug seems to be timing related and does not occur consistently, so I could not get a valid result.
Comment 8 Stéphane Guillou (stragu) 2024-04-16 02:38:10 UTC
I managed to crash OOo 3.3 on this file, tested many version of LO and could always find a way.

Usually:
1. set macro security to Low
2. open file
3. got to List sheet
4. enter text in cell C2
5. click out of cell C2
6. undo whole history (if that didn't crash, try repeatedly clicking Undo instead)

So let's mark as inherited.

The steps above crash reliably for me in a recent trunk build:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8b599d60fef80039cdfe636a771c3fc8eb1028c3
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