Bug 156356

Summary: ScriptForge new service FormDocument crashes with simple script
Product: LibreOffice Reporter: Rafael Lima <rafael.palma.lima>
Component: BASICAssignee: Jean-Pierre Ledure <jp>
Status: VERIFIED FIXED    
Severity: normal CC: jp
Priority: medium    
Version: 7.6.0.1 rc   
Hardware: All   
OS: All   
Whiteboard: target:24.2.0 target:7.6.0.2
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 159638    

Description Rafael Lima 2023-07-18 14:05:36 UTC
I am running a simple script to test the new FormDocument service in ScriptForge and I am getting an error:

Sub FormDocTest
  GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
  oDB = CreateScriptService("Database", "/home/rafael/Documents/Teste.odb")
  oFormDoc = oDB.OpenFormDocument("Produtos")
End Sub

The error message says "Variable not defined" and points to the "_Database" variable. So it appears that the variable _Database in the file SF_FormDocument is not defined, which is triggering the error.
Comment 1 Rafael Lima 2023-07-18 14:06:16 UTC
@JPL can you please take a look?
Comment 2 Jean-Pierre Ledure 2023-07-18 14:22:18 UTC
Bug confirmed in version LO 7.6.
The impacted functionality was not available yet in 7.5.

Will prepare a patch to be available before the general release of 7.6.
Comment 3 Commit Notification 2023-07-19 13:08:51 UTC
Jean-Pierre Ledure committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3480cfdb1e153ff489dcbd3790c3f120fdde13a0

ScriptForge (FormDocument) fix tdf#156356 Variable not defined

It will be available in 24.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 2023-07-21 08:42:01 UTC
Jean-Pierre Ledure committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/28755b163993a29654a17b6d189273d2ded39873

ScriptForge (SF_FormDocument) fix tdf#156356 Variable not defined

It will be available in 7.6.0.2.

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 5 Rafael Lima 2023-08-21 11:29:25 UTC
Verified with

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 38d1011282c2f34433db3dc8440eec29e357b3cf
CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL threaded