Created attachment 196796 [details] Sreenshot of error message Error message received when running a BASIC macro that defines and executes a progress bar. LibreOffice version 24.2.6.2 works fine
Please attach test file. Thank you.
Created attachment 196797 [details] Sample file with macro I create a minimal test file. Repro with Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 3d515f22100f2db75ab487e2909fa22c9574f0f1 CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: en-US Calc: CL threaded Works fine in Version: 24.2.5.2 (X86_64) / LibreOffice Community Build ID: 420(Build:2) CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: en-US Ubuntu package version: 4:24.2.5-0ubuntu0.24.04.2 Calc: threaded
@JPL can you please take a look at this one?
Created attachment 196798 [details] My macro test file Test file attached but it's basically the same as your attachment 196797 [details]. Both files work OK on version 24.2.6.2 but neither of them work on version 24.8.2.1
Created attachment 196799 [details] Error without SF error trapping
I confirm the bug with (downloaded today): Version: 24.8.2.1 (X86_64) / LibreOffice Community Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13 CPU threads: 6; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb) Locale: fr-BE (en_US.UTF-8); UI: en-US Calc: threaded I change the status to NEW. My first idea was that it was a duplicate of bug#162962. But it is not. The latter bug is fixed in the actual 24.8 version. It is however similar as it also happens inside a With statement. The root cause does not seem to be searched in the ScriptForge code in the first place. I will investigate further and try to establish what can be specific to this With block that might cause the error.
The root cause IMHO is that the error happens when the With block variable receives its content inside the With block. Next code aborts in the same way (in 24.8+ only, not in 24.2): Sub TryWith() Set a = Nothing With a If IsNull(a) Then a = ThisComponent b = .CurrentController End With End Sub I can agree that this is not a very elegant practice ... and I am ready to propose a workaround in the ScriptForge code, if relevant. But shouldn't the Basic interpreter be tolerant to this With block structure ?
(In reply to Jean-Pierre Ledure from comment #7) > But shouldn't the Basic interpreter be tolerant to this With block structure > ? I agree that this may not be elegant... but changing this behavior in the "With" may break other macros as well (extensions, user macros). I'm CC'ing Mike for some input about this. This sounds related to the issue in bug 162962.
This one is tricky ... I don't immediately see how to fix, other than reverting f3f46b5fe729876d128f63f7ab158954ab6657d7. Jean-Pierre Ledure: please do apply the workaround now, and please allow some time to consider possible fix. It is definitely a bug; it definitely needs to be fixed. Just not easy to fix in the frame of the current idea of the bug 132064, which was "make it backward-compatible": the current implementation tries to make compiled Basic binaries with WITH to keep working in older LO versions: that is needed to allow password-protected Basic libraries work there. Indeed, re-implementing the WITH from scratch would allow me to do whatever is needed - except that backward compatibility.
(In reply to Mike Kaganski from comment #9) > Jean-Pierre Ledure: please do apply the workaround now, and please allow > some time to consider possible fix. Will do. Thanks for feedback.
https://gerrit.libreoffice.org/c/core/+/174564
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ff3791f67a6421d64f5f9d6a09feaead1a63ff92 tdf#163219: only create local With variable for function results It will be available in 25.2.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.
(In reply to Mike Kaganski from comment #11) > https://gerrit.libreoffice.org/c/core/+/174564 I prepared https://gerrit.libreoffice.org/c/core/+/174560 but was prevented from pushing by Jenkins. I will retain this chang. I will abondon it if yours is validated. Thx.
(In reply to Jean-Pierre Ledure from comment #13) > I prepared > https://gerrit.libreoffice.org/c/core/+/174560 > but was prevented from pushing by Jenkins. Thank you; I resumed the CI. > I will abondon it if yours is validated. Please don't. I think it's cleaner with your patch, regardless of the fixes I made. Generally, I think that WITH is often overkill, when using the fully qualified Foo.Bar is no less readable than .Bar. Still, it's great that your framework helped so much already to catch problems that I introduced.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/0b6afed3b85b6599ecbd7e5ac97b080d3ffbbfbf ScriptForge Fix tdf#163219 With blocks It will be available in 25.2.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.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-24-8": https://git.libreoffice.org/core/commit/acd0556dc8d0ee48c4a0b338a093c9ece029a57c tdf#163219: only create local With variable for function results It will be available in 24.8.3. 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.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-24-8": https://git.libreoffice.org/core/commit/c2aa474465eb8156b0ce384bc64ba6298d2b61be ScriptForge Fix tdf#163219 With blocks It will be available in 24.8.3. 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.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/4c17c2303d2475aa080bbc10a0c5d0e9f253d505 tdf#163219: sc_scriptforge_test: Add unittest It will be available in 25.2.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.
*** Bug 163408 has been marked as a duplicate of this bug. ***