Bug 158563 - CopyToRange returns error that SF crashed
Summary: CopyToRange returns error that SF crashed
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.6.3.1 rc
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/scriptf...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-06 12:32 UTC by DZ
Modified: 2023-12-09 09:28 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sampe Calc file that shows an error when running macro (13.81 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-12-06 12:41 UTC, DZ
Details
Code pointer (90.91 KB, image/png)
2023-12-08 17:43 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description DZ 2023-12-06 12:32:17 UTC
Description:
Since upgrade to LO 7.6 macros where I use CopyToRange started to break the code.  Same code works well on Win/Lin versions 7.5 and less.  
So simple code to copy A8  to A6:A7 would result in such crash

Steps to Reproduce:
1.fillup some values to A1:D6
2.make macro Sub
3.add statement myDoc.CopyToRange("sh1.A6", "sh1.A3:A5")

Actual Results:
SF library crash
Error:
Location: SFDocuments.Calc.CopyToRange/1086
Invalid procedure call
THE EXECUTION IS CANCELLED

Expected Results:
Cell A3:A5 should be filled with value/formula from A6, as it does in versions prior 7.6


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.3.1 (X86_64)
Build ID: 60(Build:1)
CPU threads: 16; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: en-IE (en_US.UTF-8); UI: en-US
Calc: CL threaded
Comment 1 Xisco Faulí 2023-12-06 12:33:22 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 2 DZ 2023-12-06 12:41:12 UTC
Created attachment 191266 [details]
Sampe Calc file that shows an error when running macro

Run macro to see the error.
Comment 3 Julien Nabet 2023-12-06 20:09:28 UTC
On pc Debian x86-64 with master sources updated today, I don't reproduce this.

When running the macro, I got a popup indicating "A6 = 6"
then another popup indicating "You are pasting data into cells that already contain data. Do you really want to overwrite the existing data?"
I tried by clicking "Yes" and another time by clicking "No", execution isn't cancelled.
Comment 4 MM 2023-12-06 23:21:57 UTC
Confirmed on windows 10 x64 with Version: 7.6.3.2 (X86_64) / LibreOffice Community
Build ID: 29d686fea9f6705b262d369fede658f824154cc0
CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Calc: CL threaded


After running the macro it shows "A6 = 6" and then it shows

Error 5

"The ScriptForge library has crashed. The reason is unknown.
Maybe a bug that could be reported on
    https://bugs.documentfoundation.org/

More details : 

Location : SFDocuments.Calc.CopyToRange/1086
Invalid procedure call.


THE EXECUTION IS CANCELLED."
Comment 5 DZ 2023-12-08 13:02:19 UTC
(In reply to MM from comment #4)
> Confirmed on windows 10 x64 with Version: 7.6.3.2 (X86_64) / LibreOffice
> Community
> Build ID: 29d686fea9f6705b262d369fede658f824154cc0
> CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL:
> win
> Calc: CL threaded
> 
> 
> After running the macro it shows "A6 = 6" and then it shows
> 
> Error 5
> 
> "The ScriptForge library has crashed. The reason is unknown.
> Maybe a bug that could be reported on
>     https://bugs.documentfoundation.org/
> 
> More details : 
> 
> Location : SFDocuments.Calc.CopyToRange/1086
> Invalid procedure call.
> 
> 
> THE EXECUTION IS CANCELLED."

You are probably using LO prior to 7.6, as I get same response on 7.5.5, but 7.6.3 gives an error
Comment 6 DZ 2023-12-08 13:04:17 UTC
(In reply to Julien Nabet from comment #3)
> On pc Debian x86-64 with master sources updated today, I don't reproduce
> this.
> 
> When running the macro, I got a popup indicating "A6 = 6"
> then another popup indicating "You are pasting data into cells that already
> contain data. Do you really want to overwrite the existing data?"
> I tried by clicking "Yes" and another time by clicking "No", execution isn't
> cancelled.

You are probably using LO prior to 7.6, as I get same response on 7.5.5, but 7.6.3 gives an error like I described
Comment 7 DZ 2023-12-08 13:05:45 UTC
(In reply to DZ from comment #5)
> (In reply to MM from comment #4)
> > Confirmed on windows 10 x64 with Version: 7.6.3.2 (X86_64) / LibreOffice
> > Community
> > Build ID: 29d686fea9f6705b262d369fede658f824154cc0
> > CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL:
> > win
> > Calc: CL threaded
> > 
> > 
> > After running the macro it shows "A6 = 6" and then it shows
> > 
> > Error 5
> > 
> > "The ScriptForge library has crashed. The reason is unknown.
> > Maybe a bug that could be reported on
> >     https://bugs.documentfoundation.org/
> > 
> > More details : 
> > 
> > Location : SFDocuments.Calc.CopyToRange/1086
> > Invalid procedure call.
> > 
> > 
> > THE EXECUTION IS CANCELLED."
> 
> You are probably using LO prior to 7.6, as I get same response on 7.5.5, but
> 7.6.3 gives an error

Sorry that reply was meant to previous comment.  I get same result as you do on 7.6.3 Fedora 39
Comment 8 Julien Nabet 2023-12-08 13:15:00 UTC
(In reply to DZ from comment #7)
> > Sorry that reply was meant to previous comment.  I get same result as you do
> on 7.6.3 Fedora 39

I'm on master sources so dev version (future 24.2)
Comment 9 DZ 2023-12-08 13:30:01 UTC
(In reply to Julien Nabet from comment #8)
> (In reply to DZ from comment #7)
> > > Sorry that reply was meant to previous comment.  I get same result as you do
> > on 7.6.3 Fedora 39
> 
> I'm on master sources so dev version (future 24.2)

That is strange then. It looks just a 7.6.xx versions affected.  I was also checking if syntax has changed, but it seem identical text in help files for CopyToRange, so it's something to do with code.  Anyways it would be good to have parameter (overwrite) so it does/(n't) ask confirmation to overwrite if values are present in the Range, just like it works with CopyToCell
Comment 10 Rafael Lima 2023-12-08 17:43:42 UTC
Created attachment 191319 [details]
Code pointer

This works in master, but it fails in 7.6.

The problem seems to be a typo in SF_Documents.SF_Calc module, line 1086.

@JPL can you take care of this? This only needs to be fixed in 7.6.
Comment 11 Julien Nabet 2023-12-08 18:20:08 UTC
(In reply to Rafael Lima from comment #10)
> Created attachment 191319 [details]
> Code pointer
> 
> This works in master, but it fails in 7.6.
> 
> The problem seems to be a typo in SF_Documents.SF_Calc module, line 1086.
> 
> @JPL can you take care of this? This only needs to be fixed in 7.6.

Thank you Rafael, thanks to your comment, I saw the pb has been fixed with https://cgit.freedesktop.org/libreoffice/core/commit/?id=b16861f667673560cf57d28bdd16bb592e6e3c22
ScriptForge - (SF_Calc) fix typo in CopyToRange() method
Comment 12 Julien Nabet 2023-12-08 18:22:45 UTC
Here's the cherry-pick waiting for review in 7.6 branch:
https://gerrit.libreoffice.org/c/core/+/160472
Comment 13 Julien Nabet 2023-12-09 09:28:43 UTC
https://gerrit.libreoffice.org/c/core/+/160472

I tried 7.6.4 with https://gerrit.libreoffice.org/c/core/+/160476 but it needs more approvals, not sure it will make it.