Bug 151752 - Calc: Crash after copy and paste all unprotected cells
Summary: Calc: Crash after copy and paste all unprotected cells
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium critical
Assignee: Matt K
URL:
Whiteboard: target:24.8.0 target:24.2.0.3 target:...
Keywords: haveBacktrace, implementationError
Depends on:
Blocks: Cell-Sheet-Protection Cut-Copy Crash
  Show dependency treegraph
 
Reported: 2022-10-25 12:56 UTC by Timur
Modified: 2024-01-24 15:57 UTC (History)
6 users (show)

See Also:
Crash report or crash signature: ["ScDocument::HasClipFilteredRows()"]


Attachments
Test ODS (7.62 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-10-25 12:56 UTC, Timur
Details
gdb bt (8.40 KB, text/plain)
2023-09-08 06:42 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timur 2022-10-25 12:56:47 UTC
Created attachment 183258 [details]
Test ODS

1. Open test ODS
2. Select A4-A6
3. Edit-Select-Select Unprotected Cells 
4. Ctrl+C
5. Ctrl+V in the same or other cell
6. LO crash

Select Unprotected Cells in work can be clicked in mistake, wanting to select visible cells.
Comment 1 Xisco Faulí 2022-10-25 13:44:53 UTC
Reproduced in

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: f3a82a8ba51195cf31b0f78164735acc7ebbcd2f
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded
Comment 2 Xisco Faulí 2022-10-25 13:46:33 UTC
Also reproducible in

Version: 6.0.0.0.alpha1+
Build ID: 6eeac3539ea4cac32d126c5e24141f262eb5a4d9
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3; 
Locale: es-ES (es_ES.UTF-8); Calc: group threaded
Comment 3 Rainer Bielefeld Retired 2022-10-27 14:03:53 UTC
Crash Report ID for 7.5.0.0 on WIN10
Comment 4 Rainer Bielefeld Retired 2022-10-27 17:22:09 UTC
For unknown Reasons the Crash Report for 7.5 did not become visible at 
https://crashreport.libreoffice.org/

So I replaced the report ID by one created with 7.3.3.2
Crash reason: "EXCEPTION_ACCESS_VIOLATION_READ"
Comment 5 Stéphane Guillou (stragu) 2023-03-12 23:07:35 UTC
Rainer's crash report: https://crashreport.libreoffice.org/stats/crash_details/f4d27ff3-9520-48c5-a9df-f98c57e02a51

In LO 7.6, it hangs at step 4 (copying step), with high CPU usage and a loop of:

warn:legacy.osl:63279:63279:sc/source/core/data/document.cxx:4240: Wrong sheet number
Comment 6 Julien Nabet 2023-09-08 06:42:37 UTC
Created attachment 189429 [details]
gdb bt

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

I attached bt with some console logs.
Comment 7 Julien Nabet 2023-09-08 06:52:29 UTC
Just for information, I could reproduce from a brand new ods file without typing anything.

After having done step 4, I got also these messages:
warn:legacy.osl:10425:10425:sc/source/ui/app/transobj.cxx:157: no sheet selected
warn:legacy.osl:10425:10425:sc/source/core/data/documen3.cxx:1990: GetMMRect: wrong table
Comment 8 Julien Nabet 2023-09-08 17:04:03 UTC
I gave a try with https://gerrit.libreoffice.org/c/core/+/156754
but am really not sure it's the right to fix this.
Also, as indicated in the description, once we call Edit-Select-Select Unprotected Cells, copy doesn't work anymore.
Comment 9 Stéphane Guillou (stragu) 2023-09-14 15:32:55 UTC
With linux-64-releases bibisect repo, it already freezes at libreoffice-6.0.0.0.alpha1, when the feature was first available, on simpler steps (thanks Julien):

1. Open Calc
2. Edit > Select > Select Unprotected Cells 
4. Ctrl+C
5. Ctrl+V

So I'm assuming it's an implementation error.
Gülşah, can you please have a look?
Comment 10 Julien Nabet 2023-10-27 07:41:25 UTC
(In reply to Julien Nabet from comment #8)
> I gave a try with https://gerrit.libreoffice.org/c/core/+/156754
> but am really not sure it's the right to fix this.
> Also, as indicated in the description, once we call Edit-Select-Select
> Unprotected Cells, copy doesn't work anymore.

Patch abandoned since no feedback + I'm not confident enough and wouldn't like to bring some regression.
Comment 11 Matt K 2024-01-13 23:38:46 UTC
Fix is posted at: https://gerrit.libreoffice.org/c/core/+/162032
Comment 12 Commit Notification 2024-01-14 04:41:43 UTC
Matt K committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/59927dedc31eb5d51b417a02ae927eb578b90bd6

tdf#151752 Fix crash when selecting unprotected cells and copy/pasting

It will be available in 24.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 13 Commit Notification 2024-01-15 10:46:52 UTC
Matt K committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#151752 Fix crash when selecting unprotected cells and copy/pasting

It will be available in 24.2.1.

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 Timur 2024-01-15 10:47:52 UTC
Crash is fixed, thanks. 

Looking at this, I see the following:
- Select A4-A6
- Edit-Select-Select Unprotected Cells 
Select Unprotected Cells from bug 95883 was meant to select all such cells in a sheet (to delete), prior select does not work, we cannot select in a range. 
MSO can do it only via code or manual selection or Find-Format-Locked or add-on. 

- Select A4-A6
- Edit-Select-Select Visible Rows
-Select Visible Rows works for rows, not select in a range. 
MSO can select with a shortcut or Find-Special-Visible or Select Visible Cells command or add-on. There is a difference if pasted consecutively or in original positions. 

I did not find, will open enhancements.
Comment 15 Commit Notification 2024-01-15 12:18:12 UTC
Matt K committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

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

tdf#151752 Fix crash when selecting unprotected cells and copy/pasting

It will be available in 7.6.5.

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 16 Commit Notification 2024-01-15 14:22:39 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3467777fa93205b935fbe150a61e03b7b94dffc1

tdf#151752: sc_uicalc: Add unittest

It will be available in 24.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 17 Commit Notification 2024-01-24 08:29:08 UTC
Matt K committed a patch related to this issue.
It has been pushed to "libreoffice-24-2-0":

https://git.libreoffice.org/core/commit/51233ec34207c8be256d8d75800fa3ca495c5ca4

tdf#151752 Fix crash when selecting unprotected cells and copy/pasting

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