Bug 156648 - Crash in: (anonymous namespace)::XFrameImpl::implts_sendFrameActionEvent(com::sun::star::frame::FrameAction const&)
Summary: Crash in: (anonymous namespace)::XFrameImpl::implts_sendFrameActionEvent(com:...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: high critical
Assignee: Matt K
URL:
Whiteboard: target:24.2.0
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2023-08-07 07:45 UTC by guillaume.kobena
Modified: 2023-12-02 18:40 UTC (History)
1 user (show)

See Also:
Crash report or crash signature: ["(anonymous namespace)::XFrameImpl::implts_sendFrameActionEvent(com::sun::star::frame::FrameAction const&)"]


Attachments
GDB trace of crash (7.01 KB, text/plain)
2023-09-21 16:28 UTC, Buovjaga
Details
Example file with macro (8.42 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-09-21 16:38 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description guillaume.kobena 2023-08-07 07:45:26 UTC
This bug was filed from the crash reporting server and is br-bb547c81-13c4-421b-8bac-6f2a342b9944.
=========================================
REM  *****  BASIC  *****
Option Explicit

Global gFrameContextListener As Object
Global gListenedFrame As Object


Sub StartFrameActionListener
  gFrameContextListener = createUnoListener("FRAME_CONTEXT_", "com.sun.star.frame.XFrameActionListener.CONTEXT_CHANGED")
  gListenedFrame = ThisComponent.CurrentController.Frame '.getController()
  gListenedFrame.addFrameActionListener( gFrameContextListener)
End Sub

Sub StopFrameActionListener
  gListenedFrame.removeFrameActionListener( gFrameContextListener)
End Sub

Sub FRAME_CONTEXT_disposing( oEvt)
  MsgBox "Exécution de FRAME_CONTEXT_disposing( oEvt)"
End Sub

Sub FRAME_CONTEXT_contextChanged( oEvt)
  MsgBox "Exécution de FRAME_CONTEXT_contextChanged( oEvt)"
End Sub

After running StartFrameActionListener above, LO crashes as soon as I focus on the document frame. That's all !

Thank you
Comment 1 guillaume.kobena 2023-09-05 15:31:08 UTC
I begin in running the subroutine StartFrameActionListener. Then, as soon as I set focus on the component frame, LO crashes.
Comment 2 Buovjaga 2023-09-21 16:28:23 UTC
Created attachment 189741 [details]
GDB trace of crash

For me it crashes when I focus back to the macro editor after running the macro through Tools.

Arch Linux 64-bit, X11
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 899522378bfb754af757c1a4a0f6bce699ac8721
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 21 September 2023
Comment 3 Buovjaga 2023-09-21 16:37:55 UTC
Repro already in oldest of Linux 41max bibisect repo.
Comment 4 Buovjaga 2023-09-21 16:38:25 UTC
Created attachment 189742 [details]
Example file with macro
Comment 5 Matt K 2023-11-26 03:03:43 UTC
The problem is that createUnoListener doesn't return anything.  You should check existence of the return value before adding it as a listener.

That said, the LO code shouldn't allow an empty listener.  Code fix for that coming shortly.
Comment 6 Matt K 2023-11-27 01:14:12 UTC
Fix is posted at https://gerrit.libreoffice.org/c/core/+/159978
Comment 7 Commit Notification 2023-11-28 05:17:02 UTC
Matt K committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/61308112435628177b7884ab833ece843d37cd28

tdf#156648 Prevent LO from adding an empty event listener

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.