Bug 166565 - Crash when copying from Calc to Writer and undoing
Summary: Crash when copying from Calc to Writer and undoing
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: high critical
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, haveBacktrace, regression
Depends on:
Blocks: Undo-Redo
  Show dependency treegraph
 
Reported: 2025-05-13 09:14 UTC by arto
Modified: 2025-05-20 20:04 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
The Calc spreadsheet (9.55 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2025-05-13 09:58 UTC, arto
Details
The Writer document containing a table (59.28 KB, application/vnd.oasis.opendocument.text)
2025-05-13 09:59 UTC, arto
Details
The system log part that may help (84.42 KB, text/plain)
2025-05-13 10:18 UTC, arto
Details
bt (6.99 KB, text/plain)
2025-05-14 12:23 UTC, Julien Nabet
Details
Valgrind trace (42.37 KB, text/x-log)
2025-05-14 20:48 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description arto 2025-05-13 09:14:30 UTC
Description:
I have a spreadsheet open on Calc and I have a document with a filled up table open in Writer. I select a 2 col x 25 row part of the spreadsheet in Calc, copy it, go to Writer, select a 2 col x 25 row portion of the table there and paste, hoping everything to be placed nicely, overwriting the existing data. Instead, the table becomes garbled and immediately after both Writer and Calc crashes.

Steps to Reproduce:
1. I have a spreadsheet open on Calc and 
2. I have a document with a filled up table open in Writer. 
3. I select a 2 col x 25 row part of the spreadsheet in Calc, 
4. copy it, 
5. go to Writer, 
6. select a 2 col x 25 row portion of the table there and 
7. paste

Actual Results:
Didn't behave as expected, moreover both Calc and Writer crashed

Expected Results:
Behave as expected and not crash


Reproducible: Sometimes


User Profile Reset: No

Additional Info:
Please note that this is mainly a bug report about some circumstances that causes both Writer and Calc to simultaneously crash. 

Unexpected behavior regarding copying from Calc to Writer may not be a bug, but only a lack of expected functionality.
Comment 1 arto 2025-05-13 09:18:26 UTC
I'm on Fedora 42 w/Gnome. Libreoffice is installed through Fedora rpm repo. 

When the carsh happened, I tried to use the bug reporting tool of Fedora (which automatically popped up), but after some processing the tool said that there wasn't enough debug information for the reporting to proceed.
Comment 2 Xisco Faulí 2025-05-13 09:49:32 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 3 arto 2025-05-13 09:58:47 UTC
Created attachment 200773 [details]
The Calc spreadsheet
Comment 4 arto 2025-05-13 09:59:40 UTC
Created attachment 200774 [details]
The Writer document containing a table
Comment 5 arto 2025-05-13 10:03:31 UTC
I attached a Calc spreadsheet and a Writer Document. When I try to copy the A3:B27 range onto the table in the Writer document after selecting an equal range, the crash happens. I can repeat it with these two files.
Comment 6 arto 2025-05-13 10:18:15 UTC
Created attachment 200776 [details]
The system log part that may help

I also attached the system log from the time crash happened. Hope it helps
Comment 7 Andrew Kopf 2025-05-13 19:04:29 UTC
I can confirm the odd behavior by copying the table rows from Calc to Writer on Windows with the current and development builds.  I also experienced three crashes with LibreOffice while testing this. However, that was not consistent.  It copies correctly when using MS Office. 

Version: 25.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 19f3b72f34c487dc97d582712d21734a7e055fd5
CPU threads: 22; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded


Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: bbb074479178df812d175f709636b368952c2ce3
CPU threads: 22; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 8 Mateusz Wlazłowski 2025-05-13 21:41:47 UTC
For me, the crash is not immediately after paste, but when I undo with ctrl-z

Reproducible: Always

The difference with 7.2.0.1 is that upon undo, the text in the table comes back, but after 2-3 seconds Libreoffice crashes


Confirm


Ubuntu 24.04
Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: bbb074479178df812d175f709636b368952c2ce3
CPU threads: 8; OS: Linux 6.11; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 866538a4aeb30a598a6ede3d1763d898eb1920b0
CPU threads: 8; OS: Linux 6.11; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded


Version: 7.2.0.1 / LibreOffice Community
Build ID: 32efc3b7f3a71cfa6a7fa3f6c208333df48656cc
CPU threads: 8; OS: Linux 6.11; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 9 Mateusz Wlazłowski 2025-05-13 21:56:21 UTC
arto:
Do you undo or just paste?
Comment 10 arto 2025-05-14 04:39:28 UTC
You're right. I do undo. Sorry for omitting that part. It was almost a keyboard reflex that I did unconsciously.
Comment 11 Julien Nabet 2025-05-14 12:23:22 UTC
Created attachment 200800 [details]
bt

On pc Debian x86-64 with master sources updated today, I've got an assertion after having copied the cells on Writer + done an undo
Comment 12 Xisco Faulí 2025-05-14 16:28:26 UTC
Issue not reproduced in

Version: 6.4.0.0.alpha1+
Build ID: 9bc848cf0d301aa57eabcffa101a1cf87bad6470
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3; 
Locale: en-US (es_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 13 Julien Nabet 2025-05-14 20:48:55 UTC
Created attachment 200816 [details]
Valgrind trace
Comment 14 Saburo 2025-05-16 11:26:51 UTC
I think it's from here.

Version: 6.3.0.0.alpha0+
Build ID: 0c3ac02d8a3c7ea50ae262daf134c28df5c8b343
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3; 
Locale: ja-JP (ja_JP.UTF-8); UI-Language: en-US
Calc: threaded

author	László Németh
commit 0c3ac02d8a3c7ea50ae262daf134c28df5c8b343

tdf#124646 Don't paste hidden rows of Calc sheets into Writer tables
The fix for tdf#37223 creates native text tables
from the RTF clipboard data to insert them cell
by cell in Writer tables instead of OLE embedding.
Unfortunately, using Calc RTF clipboard data inserts
also the cells of the hidden rows (tdf#118676).
This improvement uses the HTML clipboard data
to paste only the visible rows.

Note: first the original patch 1) converted the clipboard
data to a temporary nested text table at the cursor position,
and 2) copied its already native table content to the
clipboard, and inserts it into the original target table.
This doesn't work with the HTML format (that inserts plain
text data within a text table cell instead of a nested
table). As a workaround, the patch removes the target text
table with the insertion point temporarily, creating the
native text table from the HTML clipboard data at the place
of the removed text table. After copying the converted
native text table data to the clipboard, the removed
table is restored, and the native clipboard data is inserted
at the original cursor position.

Change-Id: Iee5bb4027729ca1eab373029f176eeadc59388a8
Reviewed-on: https://gerrit.libreoffice.org/70425