Bug 156836 - ScriptForge Form service crashes on MoveFirst / MoveNext
Summary: ScriptForge Form service crashes on MoveFirst / MoveNext
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.6.0.2 rc
Hardware: All All
: medium normal
Assignee: Jean-Pierre Ledure
URL:
Whiteboard: target:24.2.0 target:7.6.1
Keywords:
Depends on:
Blocks: ScriptForge
  Show dependency treegraph
 
Reported: 2023-08-21 11:21 UTC by Rafael Lima
Modified: 2024-02-08 12:20 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Error when run python macro: not found scriptforge (94.28 KB, image/png)
2023-09-19 00:29 UTC, PHAM XUAN TIEN
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2023-08-21 11:21:12 UTC
The following Basic script based on ScriptForge is crashing for no apparent reason:

Sub OpenFormDocument
    GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
    Dim oDatabase As Object
    oDatabase = CreateScriptService("Database", "/path/to/file/database.odb")
    oFormDoc = oDatabase.OpenFormDocument("Produtos")
    oForm = oFormDoc.Forms(0)
    oForm.MoveFirst()
End Sub

Note that it uses the FormDocument which became available in LO 7.6. However it crashes while calling MoveFirst from the Form service.

These are the details of the crash as proviced by ScriptForge itself:

Location : SFDocuments.Form.MoveNext/923
An exception occurred 
Type: com.sun.star.sdbc.SQLException
Message: Function sequence error. at /home/rafael/Programming/libreoffice/connectivity/source/commontools/dbexception.cxx:358.
Comment 1 Jean-Pierre Ledure 2023-08-21 12:48:49 UTC
The bug is confirmed.

It happens when a move (last(), first(), next()) within the form's resultset is done from a Basic script immediately after the opening of the document containing the form.

The insertion of a
    Wait 1
statement prevents the occurrence of the incident by interrupting very shortly the Basic process.

A patch is being prepared.
Comment 2 Commit Notification 2023-08-21 15:33:57 UTC
Jean-Pierre Ledure committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/84bc3ffcf5c570f044843125552589456b07f5a1

ScriptForge - fix tdf#156836 Abort on MoveFirst()

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 3 Commit Notification 2023-08-22 10:53:08 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/57d492a77143e9cc25e6ab6f292d184ff2f0c108

ScriptForge - fix tdf#156836 Abort on MoveFirst()

It will be available in 7.6.1.

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 PHAM XUAN TIEN 2023-09-18 06:04:47 UTC
Still error on 7.6.1 rc2
Comment 5 Jean-Pierre Ledure 2023-09-18 17:23:58 UTC
Please check if the error still occurs in the 7.6.1.2 release, which is today the official downloadable "fresh" release.
The 7.6.1.2 release contains anyway the patch.
Comment 6 PHAM XUAN TIEN 2023-09-19 00:29:31 UTC
Created attachment 189683 [details]
Error when run python macro: not found scriptforge

Still get error
Version information:
Version: 7.6.1.2 (x86_64)/LibreOffice Community
Environment: CPU threads: 4; OS: Linux 6.5
User Interface: UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Misc: Ubuntu package version: 4:7.6.1_rc2-0ubuntu2
      Calc: threaded
Comment 7 PHAM XUAN TIEN 2023-09-19 05:37:12 UTC
7.6.0.3 runs smooth on window
Comment 8 Jean-Pierre Ledure 2023-09-21 09:13:27 UTC
(In reply to PHAM XUAN TIEN from comment #6)
> Created attachment 189683 [details]
> Error when run python macro: not found scriptforge
> 
> Still get error
> Version information:
> Version: 7.6.1.2 (x86_64)/LibreOffice Community
> Environment: CPU threads: 4; OS: Linux 6.5
> User Interface: UI render: default; VCL: gtk3
> Locale: en-US (en_US.UTF-8); UI: en-US
> Misc: Ubuntu package version: 4:7.6.1_rc2-0ubuntu2
>       Calc: threaded

The error message claims about the absence of the scriptforge.py module.
The file is normally located in
   $INSTALL/program

Check your installation, your python path, ... ?

Anyway, IMO, the observed behaviour has nothing to do with the current bug report.
Comment 9 PHAM XUAN TIEN 2023-09-27 00:50:29 UTC
Still got error with 7.6.1 rc1
(In reply to Jean-Pierre Ledure from comment #8)
> (In reply to PHAM XUAN TIEN from comment #6)
> > Created attachment 189683 [details]
> > Error when run python macro: not found scriptforge
> > 
> > Still get error
> > Version information:
> > Version: 7.6.1.2 (x86_64)/LibreOffice Community
> > Environment: CPU threads: 4; OS: Linux 6.5
> > User Interface: UI render: default; VCL: gtk3
> > Locale: en-US (en_US.UTF-8); UI: en-US
> > Misc: Ubuntu package version: 4:7.6.1_rc2-0ubuntu2
> >       Calc: threaded
> 
> The error message claims about the absence of the scriptforge.py module.
> The file is normally located in
>    $INSTALL/program
> 
> Check your installation, your python path, ... ?
> 
> Anyway, IMO, the observed behaviour has nothing to do with the current bug
> report.

Still got error with 7.6.2 rc1
I upgrade by: 
sudo add-apt-repository ppa:libreoffice/ppa
sudo apt update
sudo apt upgrade
Comment 10 Jean-Pierre Ledure 2023-09-27 07:08:25 UTC
I discovered today that Ubuntu has recently decided to build a separate package for the scriptforge/python interface, called

   python3-scriptforge

Probably it should be installed separately in your environment.

Anyway this should be reported in a separate bug report. It has nothing to do with the actual one.