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
I temporarily removed $HOME/.config/libreoffice/4 and reproduced the bug, so it's not my user profile.
Created attachment 176086 [details] valgrind trace from a fresh dev build
Repro: Version: 7.2.3.1 (x64) / LibreOffice Community Build ID: 1d5dee817bde88d78dbcc0d00f88492568e131d5 CPU threads: 12; OS: Windows 10.0 Build 19043; UI render: default; VCL: win Locale: ru-RU (ru_RU); UI: en-US Calc: threaded
One interesting finding about this bug is that it has nothing to do with your macro. The same bug happens with any macro provided that you insert a sheet while the processing is stopped by a break point. For instance, try the following macro: Function IncrementByTen(v1 as Variant) As Variant IncrementByTen = v1 + 10 End Function Then insert any value in cell A1 (e.g. 5) and in cell A2 enter '=INCREMENTBYTEN(A1)' Place a break point in the second line of this function (where 'IncrementByTen = v1 + 10' is). Now insert a sheet and when the break point is reached, if you click the Run button, infinite sheets will be inserted. Inserting a sheet without any break points does not cause the problem. This bug is probably related to how user functions are called when a break point is active, causing an infinite loop.
Dear studog, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
I tried my own reproduction steps, and the steps from https://bugs.documentfoundation.org/show_bug.cgi?id=145487#c4 . In both cases the bug does not occur. Some change between 7 and version 24 has likely fixed this. About info: Version: 24.2.6.2 (X86_64) / LibreOffice Community Build ID: 420(Build:2) CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: en-CA (en_CA.UTF-8); UI: en-US Ubuntu package version: 4:24.2.6-0ubuntu0.24.04.1 Calc: threaded