https://bugs.documentfoundation.org/show_bug.cgi?id=145487
Bug ID: 145487
Summary: UI BASIC
Product: LibreOffice
Version: 7.2.2.2 release
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
A fairly unassuming macro causes the Add Sheet button to add infinite sheets to
a workbook.
This is affecting my current project which isn't large but has complexity. I've
narrowed it down to a small 100% reproducible test case.
Steps to reproduce
1. Start with Calc (and all Office apps) complete closed. Open Calc.
2. Tools -> Macros -> Edit Macros
3. In the editor click the Modules toolbar button to add 'Module1' to 'Untitled
1'. Modules button -> expand 'Untitled 1' -> select 'Standard' -> New... ->
accept defaults by clicking Ok -> Close Macro Organizer dialog
4. In the navigation on the left, select the newly added 'Module1': Expand
'Untitled 1' -> Expand Standard -> double click 'Module1'.
5. Add macro to module. There will be a pre-populated template, delete that.
Then add this:
function infiniteSheets(q1 as variant, q2 as variant, q3 as variant, q4 as
variant)
dim w1 as variant
if IsEmpty(w1) then
infiniteSheets = w1
exit function
end if
infiniteSheets = ""
end function
6. Set a breakpoint on line 3 by double-clicking just to the left of the '3'
line number. A red circle with a dot should appear.
7. Switch back to the untitled spreadsheet window.
8. In cell A1 enter the text '=infinitesheets(A2,B2,C2,D2)' then hit enter.
9. OBSERVE: the breakpoint isn't hit. This is probably a secondary bug worth
its own bug report, but it's not the focus of this bug report.
10. In the status bar, click the Add Sheet button.
11. OBSERVE: The breakpoint is hit.
12. Press the run button in the Macro Editor window.
13. OBSERVE: The main Calc window is now adding an infinite number of sheets.
14. Clicking the Add Sheet button a second time halts the process.
In my original project there was some dependency on the macro arguments. I was
passing in an array from a column of cells that happened to have no values or
formulas. This was argument number 5 of 6 arguments. The problem would
reproduce when this empty array was in positions 4, 5, or 6, but not in 3 or 1.
The reproduction above takes 4 arguments but I haven't tried to find out if
that's important or not. The reproduction doesn't actually use any of the
arguments, unlike my project.
While I've been typing this, I let the process run. It has stopped adding
sheets after 3688 sheets, but the cursor is still in the spinning wheel form
indicating processing is ongoing, just no longer adding sheets.
UPDATE: Sheets are still being added, the UI is just updating with extreme lag.
Currently at 4984.
In my project, I was able to avoid the issue by removing parts of the macro,
but it wasn't clear why that worked. In the reproduction case, the delay of
responding to the breakpoint hit to press run to let it continue appears to be
critical. Run the reproduction and skip setting the breakpoint in step 6, the
problem won't occur. I suspect that how long the macro runs vis a vis the Add
Sheet functionality running is important.
Part of my project is a macro that instantiates a new templated sheet. Today is
the first time I hit the Add Sheet button on my project in quite a long time. I
don't know if this bug is new in 7.2.2.2 or has been around for a while.
Data:
studog@home:~$ uname -a
Linux home 5.4.0-87-generic #98~18.04.1-Ubuntu SMP Wed Sep 22 10:45:04 UTC 2021
x86_64 x86_64 x86_64 GNU/Linux
studog@home:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
Version: 7.2.2.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (C.UTF-8); UI: en-US
Ubuntu package version: 1:7.2.2~rc2-0ubuntu0.18.04.1~lo1
Calc: threaded
7.2.2.2 is a recent upgrade:
2021-10-17 01:30:37 upgrade libreoffice-base-drivers:amd64
1:7.1.6~rc2-0ubuntu0.18.04.1~lo1 1:7.2.2~rc2-0ubuntu0.18.04.1~lo1
2021-10-17 01:30:38 upgrade libreoffice-calc:amd64
1:7.1.6~rc2-0ubuntu0.18.04.1~lo1 1:7.2.2~rc2-0ubuntu0.18.04.1~lo1
--
You are receiving this mail because:
You are the assignee for the bug.