Created attachment 181255 [details] Sample file with scripts I have a Basic dialog with a "Close" button in it. Using the SF Dialog service in Basic to display the dialog and then close it using a callback function also written in Basic works as expected. Below is the code in Basic that processes the event: Sub CloseDialog_Basic(oEvent) btnControl = CreateScriptService("DialogEvent", oEvent) myDialog = btnControl.Parent myDialog.EndExecute() End Sub However the equivalent code in Python does not work. It seems the code never exits the EndExecute() call. def btn_close_click(event=None): btn_control = CreateScriptService("DialogEvent", event) my_dialog = btn_control.Parent my_dialog.EndExecute(0) There seems to be something holding the interpreter after the EndExecute call. I attached a file with the scripts in Basic and Python for testing. System info: Version: 7.3.4.2 / LibreOffice Community Build ID: 30(Build:2) CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: pt-BR Ubuntu package version: 1:7.3.4-0ubuntu0.22.04.1 Calc: threaded
The bug is confirmed in master and 7.4 branches. The EndExecute() is not executed when next conditions are met: - the dialog is opened in modal mode from a Python user script (Execute) - the control event closing the dialog (EndExecute) is also run from a Python user script (when one or both of them is/are a Basic script, there is no issue). The root cause is that - both runs make use of the CallByName Basic native function - the Execute() is suspended until the closure of the dialog => the CallByName is also suspended - it seems that during its execution, the CallByName function locks the concerned object instance for exclusive use. Instead of running EndExecute, CallByName immediately cancels the running process. The bug can be fixed by forcing a hardcoded call to the methods in the Dialog service which may potentially be called while the dialog is open, bypassing the generic CallByName method: Activate Center EndExecute Resize
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/91a1662c66e5e988d36012533fceab9221607282 ScriptForge - tdf#149983 dialog.EndExecute() failure It will be available in 7.5.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.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/b56cf8b8c97215a3422532e9a98bef3110fab7c1 ScriptForge - tdf#149983 dialog.EndExecute() failure It will be available in 7.4.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.
I tested the patch with the sample document and both dialogs (Basic and Python) close as expected. Setting this as FIXED.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/cd8ab93d9b84ed34d18334e07e1e11bd1728e161 ScriptForge - tdf#149983 dialog.Execute() failure It will be available in 7.5.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.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/d1e09ee551b18eedb46c2bb4bc5cd175b94bcd93 ScriptForge - tdf#149983 dialog.Execute() failure It will be available in 7.4.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.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/356bb47cb404eb54d1aea4ae7ab72c13e5f904ea ScriptForge - tdf#149983 dialog.EndExecute() failure It will be available in 7.3.6. 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.