Bug 163683 - After upgrade from LO 24.2.5 to 24.8.2 problems with macros occurred
Summary: After upgrade from LO 24.2.5 to 24.8.2 problems with macros occurred
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.8.2.1 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2024-10-30 07:54 UTC by Orwel
Modified: 2024-11-02 19:06 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
test file with macro causing crash of LO (69.72 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-10-30 10:10 UTC, Orwel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Orwel 2024-10-30 07:54:54 UTC
Description:
I have upgrade LO from  24.2.5 to 24.8.2 (and also Java to actual build 1.8.0_431-b10) I face problems with macros stored in sCalc file, which were working in 24.2 without any problems:
1. macro:
sub QRweb
	createUnoService("com.sun.star.system.SystemShellExecute").execute( _
		ConvertToURL(ThisComponent.getSheets().getByName("QR").getCellRangeByName("A14").getString()),,0)

end sub

Running this macro gives an error on first line “BASIC runtime error. Argument is not optional.” although macro runs and opens the web page.

2. macro:
sub ResizeQR
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:TransformDialog", "", 0, Array())

rem ----------------------------------------------------------------------
dim args2(3) as new com.sun.star.beans.PropertyValue
args2(0).Name = "TransformPosX"
args2(0).Value = 50
args2(1).Name = "TransformPosY"
args2(1).Value = 10500
args2(2).Name = "TransformWidth"
args2(2).Value = 4300
args2(3).Name = "TransformHeight"
args2(3).Value = 4940

dispatcher.executeDispatch(document, ".uno:TransformDialog", "", 0, args2())


end sub

Running this macro makes LO crash. 

Steps to Reproduce:
What I have tried:
1. Installed through Separate Install GUI back the version 24.2.5.2 and tried to run macros - works still fine.
2. Copied the user profile from actual LO to the separate 24.2.5.2 and tried to run macros - works fine. Java is enabled
3. Installed a separate 24.8.2. version with a clear user profile and tried to run macros on the file - error (macro 1) / crashed (macro 2)

Actual Results:
some problems with macros

Expected Results:
no problems should occur


Reproducible: Always


User Profile Reset: Yes

Additional Info:
It makes no difference, if Java experimental features are enabled or not, I tried in 24.8 both possibilities.
Comment 1 Orwel 2024-10-30 08:02:55 UTC
version 24.8.3.1 is also affected in the same way.
Comment 2 Mike Kaganski 2024-10-30 09:44:16 UTC
This is not a bug - the `execute` method of XSystemShellExecute[1] has no optional arguments, and using it as you did (putting no arguments between commas) was only working by accident before the fix for bug 162431, because the error code 448 for missing argument was passed as an integer there instead, which is definitely wrong.

[1] https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1system_1_1XSystemShellExecute.html#af7a73d7840dfafddb1bfb0e10c4ec8e0
Comment 3 Mike Kaganski 2024-10-30 09:47:29 UTC
Oh - there is the crash second part (which is, of course, wrong - a single issue for a single problem). Well, since the first part is not a bug, we can handle the second part here, instead.

How should this macro be called? Which component? Should a specific document be open?
Comment 4 Mike Kaganski 2024-10-30 09:52:40 UTC
The crash for the second crasher issue happens e.g. when you create a new Impress document, select a (bottom) frame on the default slide, and run the macro.

The crash is in SfxItemPool::GetUserOrPoolDefaultItem, and that is likely a regression after Armin's ITEM rework.

Also adding Noel, he may have an idea what to do.
Comment 5 Orwel 2024-10-30 10:10:57 UTC
Created attachment 197297 [details]
test file with macro causing crash of LO
Comment 6 Orwel 2024-10-30 10:11:48 UTC
I am attaching a sample file with the macro. What is should do is to resize a picture.
How do I use it:
1. create QR code on specific web site
2. Copy image from the web site, pasting the image into scalc sheet.
3. Press button QR (the image has to be selected) - that should run the macro, which should resize the image and place it on a specific place in document.
Comment 7 Orwel 2024-10-30 10:15:16 UTC
I have forgot to mention, thank you for explanation of macro 1, which i did not know about, as i am not very familiar with macros - I found this macro on the web and it worked for a while, so I did not know, that the problem is the macro itself, as I forced 2 problems with macros at the same time.
Comment 8 Noel Grandin 2024-10-30 13:12:07 UTC
This bug started before Armin's work, I tested to before commit bd6c6d46e82eb5cf5839a5b99e4838471250e959.

It's going to need a bibisect I think.

From a cursory examination, it looks like the macro is trying to use an internal slot and the macro is not populating all of the values that the slot processing code expects.

Specifically the code wants SID_ATTR_TRANSFORM_SIZE_POINT.

Unfortunately, I don't see a way to pass SID_ATTR_TRANSFORM_SIZE_POINT from macro code right now, because the declaratation in the svx.sdi file does not include that parameter.