Bug 155129 - Macro hangs after executing uno:GoToEndOfRow
Summary: Macro hangs after executing uno:GoToEndOfRow
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2023-05-02 17:40 UTC by Nick
Modified: 2023-05-17 19:22 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Test Macros (28.00 KB, text/plain)
2023-05-02 17:42 UTC, Nick
Details
example ODS with macro (8.47 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-05-04 12:09 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick 2023-05-02 17:40:02 UTC
Attached is an odt file containing 3 macros, Temp, Temp1 & Temp2. Temp calls Temp1 and Temp2.
Temp1 and Temp2 contain nothing but cell movements via many variations dispatcher.executeDispatch(document, ".uno:GoToEndOfData"
dispatcher.executeDispatch(document, ".uno:GoUp". etc.
After loading the macros, please open any Calc file containg at least 2 sheets, and run macro Temp.

My result is a HANG that occurs in Temp1 after a
dispatcher.executeDispatch(document, ".uno:GoToEndofRow"

After using Task Manager to close open office, the "End" key on the keyboard doesn't work. I have to reboot my computer.
Comment 1 Nick 2023-05-02 17:42:39 UTC
Created attachment 187062 [details]
Test Macros

Forgot to add attachmnet.
Comment 2 Stéphane Guillou (stragu) 2023-05-02 21:34:44 UTC
Can you please test again in a version that is currently in development, 7.4 or 7.5?
If the issue is still there, please attach an ODS file with the macros saved in it, so others can test more easily.
Thank you!
Comment 3 Nick 2023-05-03 14:35:43 UTC
I've installed Ver 7.5, and quickly checked it with my original macros. I got the "Hang" in the same location.

When I ran the Temp ("Test") macro I did get something different:

BASIC runtime error.
Object variable not set.

That messaged occurred after Temp1 was called on the first line of code.

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

Now args2 is defined in Temp as :

Dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Sel"
args2(0).Value = false

I've never had that happened before. The only thing I can think of is a change in the code, which I shall try to chase down.
Comment 4 QA Administrators 2023-05-04 03:22:21 UTC Comment hidden (obsolete)
Comment 5 Stéphane Guillou (stragu) 2023-05-04 12:09:52 UTC
Created attachment 187081 [details]
example ODS with macro

I've put the macro in this example document for easier testing.
I also get the "Object variable not set" error in both 6.0 and 7.6, but unsure if this is a syntax error or something else.
Comment 6 Nick 2023-05-04 13:22:38 UTC
I've down some more chasing dwon what's occuring. The "Hanging" is occurring on the Call of the second macro when it tries to execute dispatcher.executeDispatch(document, ".uno:GoToEndOfRow".

I found the problem starts in the Call of the first macro after the execution of 
dispatcher.executeDispatch(document, ".uno:GoToEndOfRow"

I stopped the execution after the first execution and found that although the macro doesn't "Hang", the "End" key on the keyboard was not working! Ergo the second execution is trying to do something that the keyboard can't even do.

FYI, Ctrl + End still does work.

I then have to reboot the computer to get the "End" key to work as it should.

I have access to a Linux computer to see what happens with that OS but that will take some time.

Regarding stephane.guillou@libreoffice.org comments I found I could eliminate that error by inserting
dim document, dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
in the called macro.
Note: I never had to do that before.
Comment 7 Nick 2023-05-17 15:49:27 UTC
I just upgraded:
Version: 7.5.3.2 (X86_64) / LibreOffice Community
Build ID: 9f56dff12ba03b9acd7730a5a481eea045e468f3
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

BUG no longer exists!