Bug 168750 - Names defined in a class module are visible without an instantiated class, during loading
Summary: Names defined in a class module are visible without an instantiated class, du...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL: https://ask.libreoffice.org/t/using-s...
Whiteboard: target:26.2.0 target:25.8.3
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-08 14:26 UTC by Mike Kaganski
Modified: 2025-10-20 08:58 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
An UDF using a name clashing with a class module's function (10.83 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-10-08 14:26 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2025-10-08 14:26:28 UTC
Created attachment 203210 [details]
An UDF using a name clashing with a class module's function

Ref: https://ask.libreoffice.org/t/using-scriptforge-breaks-failure-free-loading-of-a-document-after-a-restart-of-libreoffice/127551/

Open the attachment.
It contains a library with a class module with some function, and a library with a normal module with a user-defined spreadsheet function (UDF), that uses the same name as in the class module. Since the names in class modules are normally not visible outside the module, unless they are used on an instance of the class, it is expected that the names do not clash. However, they do during the load.

Expected:
  - No errors during load; the formula in B1 is FALSE

Actual:
  - "Argument is not optional" error during load; the formula in B1 is TRUE
Comment 1 Vladimir Sokolinskiy 2025-10-08 14:47:17 UTC
Repro.

Error during load; the value of cell B1 is an empty string.
After recalculation, the value of cell B1 is 1.
Comment 2 Mike Kaganski 2025-10-08 19:25:37 UTC
https://gerrit.libreoffice.org/c/core/+/192075
Comment 3 Commit Notification 2025-10-09 03:58:50 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/79a2e1d861c9e6b8cc7e9ff3fbb298475176bcf1

tdf#168750: Make sure that class module is recognized on load

It will be available in 26.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.
Comment 4 Commit Notification 2025-10-20 08:58:00 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/5219ea7b98bb35fc9f4ec39f25ebfafb7346bc25

tdf#168750: Make sure that class module is recognized on load

It will be available in 25.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.