Bug 165191 - Menu created by ScriptForge crashes document
Summary: Menu created by ScriptForge crashes document
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
25.2.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: ScriptForge
  Show dependency treegraph
 
Reported: 2025-02-11 10:21 UTC by mrupio
Modified: 2025-02-12 12:56 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file to reproduce. (12.29 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-02-11 10:25 UTC, mrupio
Details
Backtrace of the crash in gen (5.49 KB, text/x-log)
2025-02-12 12:55 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mrupio 2025-02-11 10:21:44 UTC
Description:
Hello!

In Calc document I create new menu and menu item:

Sub CreateMenu()
    Dim oDoc as Object, oMenu as Object

    GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
  
    Set oDoc = CreateScriptService("Document")
    Set oMenu = oDoc.CreateMenu("MyMenu")
    oMenu.AddItem("Item 1", Script := "vnd.sun.star.script:Standard.Module1.Menu_Listener?language=Basic&location=document")
    oMenu.Dispose()
End Sub

When user clicks "Item 1" following event handler is launched:

Sub Menu_Listener(args As String)
    ' don't finish before 5 s
    Wait(5000)
End Sub

Now, if user clicks "MyMenu" within 5 seconds, the document crashes (just after event handler finishes).




Steps to Reproduce:
1. Create menu and menu item (using ScriptForge)
2. Create long lasting event handler and attache it to menu item created in step 1.
3. Click main menu created in stem 1. before event handler finishes.
4. Let the event handler to finish.
5. Entire document crashes.

Actual Results:
Document crashes.

Expected Results:
Document stays alive.


Reproducible: Always


User Profile Reset: No

Additional Info:
I was wondering how to disable menu at the beginning of the event handler and enable it just before it finishes, but I don't know how to do it. I would be nice if someone descibes how to do it.
Comment 1 mrupio 2025-02-11 10:25:52 UTC
Created attachment 199130 [details]
Sample file to reproduce.
Comment 2 mrupio 2025-02-11 10:36:41 UTC
In "Steps to Reproduce" I forgot to write "Click menu item" after step 2.
Comment 3 Xisco Faulí 2025-02-11 11:16:43 UTC
Reproduced in

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 7da1497aa462e2b719aa9b308a749caf7b9a19b1
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: x11
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded
Comment 4 Xisco Faulí 2025-02-11 11:17:57 UTC
Also reproduced in

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 898d5d470e24a55556f2fb244fec24df33ba8855
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: x11
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded
Comment 5 Rafael Lima 2025-02-11 19:10:36 UTC
It did not crash for me in:

Version: 24.8.4.2 (X86_64)
Build ID: 480(Build:2)
CPU threads: 12; OS: Linux 6.12; UI render: default; VCL: kf6 (cairo+wayland)
Locale: pt-BR (en_US.UTF-8); UI: en-US
Calc: threaded

And it did not crash in

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 862e86d187c53ab077b672997ca8d9623396b962
CPU threads: 12; OS: Linux 6.12; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: CL threaded

Maybe this bug is Windows-only?

@JPL what's your opinion?
Comment 6 Werner Tietz 2025-02-11 20:54:53 UTC
(In reply to Rafael Lima from comment #5)

> 
> Maybe this bug is Windows-only?

maybe you should read carefully Comments #3 and #4
Comment 7 Xisco Faulí 2025-02-12 08:24:04 UTC
Hi Rafael,
I can reproduce it with GEN environment
Comment 8 Jean-Pierre Ledure 2025-02-12 11:30:49 UTC
I could not reproduce the issue in

Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 6; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fr-BE (en_US.UTF-8); UI: en-US
Calc: threaded

(The Linux system is located in a VirtualBox Version 6.1.50_Ubuntu r161033 VM).
Comment 9 Werner Tietz 2025-02-12 11:39:46 UTC
(In reply to Jean-Pierre Ledure from comment #8)
> I could not reproduce the issue in

Did you first disable Java -path explicitly and complete restart the soffice ??
Comment 10 Rafael Lima 2025-02-12 12:55:06 UTC
Created attachment 199167 [details]
Backtrace of the crash in gen

(In reply to Werner Tietz from comment #6)
> maybe you should read carefully Comments #3 and #4

So these are the steps I followed:

1) Click "Create menu" button
2) Click "My Menu" - "Item 1"
3) Quickly click "My Menu" - "Item 1" again before the 5 seconds

I got no crash on kf6... I saw the message box twice.

On gen it crashed after the second message box.

Here's the backtrace.
Comment 11 Werner Tietz 2025-02-12 12:56:29 UTC
(In reply to Werner Tietz from comment #9)
> (In reply to Jean-Pierre Ledure from comment #8)
> > I could not reproduce the issue in
> 
> Did you first disable Java -path explicitly and complete restart the soffice
> ??

please ignore my comment #9 … wrong topic