Bug 132563 - Empty parameter of type variant does no longer work in sub
Summary: Empty parameter of type variant does no longer work in sub
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha0+
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.1.0 target:7.0.0.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
 
Reported: 2020-04-30 17:58 UTC by Regina Henschel
Modified: 2020-06-16 13:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer document with test macro (11.31 KB, application/vnd.oasis.opendocument.text)
2020-04-30 17:58 UTC, Regina Henschel
Details
Example with pure Basic, call Echo_Input_bySub (10.99 KB, application/vnd.oasis.opendocument.text)
2020-05-16 23:48 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2020-04-30 17:58:33 UTC
Created attachment 160145 [details]
Writer document with test macro

Enable macro execution.
Open attached file. It contains macros. The purpose of the macros is to examine shapes in Writer.

Select the shape and then run macro "examineShape_inWriter".

Expected: Shows msgbox "success".

Actual: error: Incorrect property value


I see the error in Version: 7.0.0.0.alpha0+ (x64)
Build ID: f924658e45f256544e43c3fdb2af9b585d0f0933
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: Skia/Vulkan; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: CL

It was OK in Version: 7.0.0.0.alpha0+ (x64)
Build ID: 6388c578c672690fff662cb04b6a0436cd742f37
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: Skia/Vulkan; VCL: win; 
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded
Comment 1 himajin100000 2020-05-15 05:23:15 UTC
the script does not work NOT BECAUSE getByIndex doesn't work BUT BECAUSE getSelectedShape_inWriter is called with nothing assigned to oShape(i.e. EMPTY) in examineShape_inWriterexamineShape_inWriter.
Comment 2 himajin100000 2020-05-15 05:28:46 UTC
sub examineShape_inWriter
dim oDocument as variant: oDocument = ThisComponent
dim oShape as variant

REM assign something
oShape = 1

getSelectedShape_inWriter(oShape)
rem for to set breakpoint
dim dummy as integer
dummy = 1
end sub
Comment 3 Regina Henschel 2020-05-15 11:21:56 UTC
(In reply to himajin100000 from comment #1)
> the script does not work NOT BECAUSE getByIndex doesn't work BUT BECAUSE
> getSelectedShape_inWriter is called with nothing assigned to oShape(i.e.
> EMPTY) in examineShape_inWriterexamineShape_inWriter.

The script works in released versions and therefore should work in the upcoming next version too.
Comment 4 Regina Henschel 2020-05-16 23:46:45 UTC
(In reply to himajin100000 from comment #1)
> the script does not work NOT BECAUSE getByIndex doesn't work BUT BECAUSE
> getSelectedShape_inWriter is called with nothing assigned to oShape(i.e.
> EMPTY) in examineShape_inWriterexamineShape_inWriter.

You are right. getByIndex is OK, but the parameter of sub is the problem.

So the problem is, that something was changed in parameter handling for sub.


REM  *****  BASIC  *****
option explicit

sub UserInput_bySub (aInput as variant)
aInput = InputBox("Enter something","Test of empty parameter as sub","write here")
end sub

sub Echo_Input_bySub
dim oInput as variant: UserInput_bySub(oInput)
msgbox("You entered " & oInput)
end sub


That works in LibreOffice Version: 6.4.3.2 (x64), but does not work in Version: 7.0.0.0.alpha1+ (x64).
Comment 5 Regina Henschel 2020-05-16 23:48:44 UTC
Created attachment 160916 [details]
Example with pure Basic, call Echo_Input_bySub
Comment 6 Buovjaga 2020-06-10 18:22:53 UTC
Bibisected with Linux 6.5 repo to https://git.libreoffice.org/core/+/84b884135ee419fe7abfefa7b4b651a649cf9ad9%5E!/
tdf#79426, tdf#125180 - Don't convert missing parameters to requested type

I see Andreas is already in CC :)
Comment 7 Commit Notification 2020-06-11 13:27:10 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/345cb192f0bc2fef97ae52ade48efc2d8591a165

tdf#132563 - Convert parameters of type SbxEMPTY

It will be available in 7.1.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 8 Buovjaga 2020-06-12 19:12:41 UTC
Thanks for fixing, I verified it!

Arch Linux 64-bit
Version: 7.1.0.0.alpha0+
Build ID: de1b634a151c198584dc152676183f519c50a2da
CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 12 June 2020
Comment 9 Commit Notification 2020-06-16 13:15:31 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

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

tdf#132563 - Convert parameters of type SbxEMPTY

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