Bug 149482 - XModifyListener triggering infinite creation of new sheets
Summary: XModifyListener triggering infinite creation of new sheets
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.6 target:7.5.2 target:7.6.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Sheet-Tabs-Bar
  Show dependency treegraph
 
Reported: 2022-06-07 23:07 UTC by Rafael Lima
Modified: 2023-02-20 15:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file (9.83 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-06-07 23:07 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2022-06-07 23:07:24 UTC
Created attachment 180625 [details]
Sample file

Open the sample file. It has a simple macro that relies on XModifyListener.

Global oListener

Sub InitializeListener
    Set oListener = CreateUnoListener("listen_", "com.sun.star.util.XModifyListener")
    ThisComponent.addModifyListener(oListener)
End Sub

Sub listen_modified(aEvent)
    MsgBox "Modified"
End Sub

Sub listen_disposing(aEvent)
    ' Do nothing
End Sub

The idea of this macro is to capture any modify event and print "Modified". However, when you create a new sheet what it does is infinitely print "Modified" and then create a new sheet.

Steps to reproduce:
1) Open the sample file and click the "Initialize Listener" button (this will run the InitializeListener sub)
2) Click the "+" icon at the bottom left to create a new sheet
3) Notice that LO will enter an infinite loop of printing "Modified" and then creating a new sheet

The expected behavior is that it should print "Modified" just once and then return, without creating further new sheets.

System info:

Version: 7.3.3.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.3~rc2-0ubuntu0.21.10.1~lo1
Calc: threaded
Comment 1 Buovjaga 2023-02-13 10:53:12 UTC
Bibisected with linux-64-7.2 to
https://git.libreoffice.org/core/commit/aa0657e2983007c505b1223281df4a3a4eb6e73a
weld ImplTabButtons
Comment 2 Caolán McNamara 2023-02-13 20:14:44 UTC
this button, when held down, will continue to insert sheets while held down, and I think it believes it is still held down because it doesn't see a mouse up, due to the dialog stealing it away
Comment 3 Commit Notification 2023-02-14 10:10:17 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/84797ab79e3f1a37e630abffc47bfe43fbf66c22

Resolves: tdf#149482 don't insert if the mouse is not still pressed

It will be available in 7.4.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.
Comment 4 Commit Notification 2023-02-14 10:10:20 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/2f1b0d9a89ade17c9e42b584669fa8a0892e06b3

Resolves: tdf#149482 don't insert if the mouse is not still pressed

It will be available in 7.5.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 Commit Notification 2023-02-14 11:34:36 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1b180c444d0c7d8b2df66c88f0bdadfec4896b00

Resolves: tdf#149482 don't insert if the mouse is not still pressed

It will be available in 7.6.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.