Bug 160446 - LibreOffice Calc crashes when control is remove with a popup up menu displayed
Summary: LibreOffice Calc crashes when control is remove with a popup up menu displayed
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.0.3 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2024-03-31 14:02 UTC by vibrationoflife
Modified: 2024-04-01 09:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature: https://crashreport.libreoffice.org/stats/crash_details/78e6d02a-bb9a-4633-af9a-8b5e6b8cbe9e


Attachments
A simpler self-contained reproducer (10.73 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-03-31 15:13 UTC, Mike Kaganski
Details
bt with console logs (21.78 KB, text/plain)
2024-04-01 08:11 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vibrationoflife 2024-03-31 14:02:32 UTC
Description:
LibreOffice Calc crashes when control is remove with a popup up menu displayed.

This behaviour can be see in my Cell Controls Example:
https://github.com/Amourspirit/python-ooouno-ex/tree/34108410d0c4b52a2d9668c961813fa8529f991b/ex/auto/calc/odev_cell_controls

In the example controls are dynamically added to the sheet when a cell is clicked.
I set an event to remove the control when it looses focus. This seems to work fine with the following excptions.

If the control popup menu is activated (right click) then the control loose focus and tries to remove itself from the sheet. When the menu active this causes a crash and LibreOffice Calc completly disappears.

Also, if I recall correctly if the control is not removed before switching sheets it will also crash. But, I put in an event handler to make sure the control is removed before sheet activation changes

This crash may happen in other LibreOffice Applications, I did not test for this.

Related Bug: Forms Listeners stop working after a different sheet is activated.
https://bugs.documentfoundation.org/show_bug.cgi?id=159134

Related: How to stop Menu activation for a control?
https://ask.libreoffice.org/t/how-to-stop-menu-activation-for-a-control/104160

Steps to Reproduce:
1. Start the example, link in description.
2. Click on a cell in COL B or C, this will insert a control.
3. Right click on the control, Calc will crash.

Actual Results:
Calc will crash

Expected Results:
Popup menu just exits gracefuly if the control is removed.


Reproducible: Always


User Profile Reset: No

Additional Info:
Related Bug: Forms Listeners stop working after a different sheet is activated.
https://bugs.documentfoundation.org/show_bug.cgi?id=159134

Related: How to stop Menu activation for a control?
https://ask.libreoffice.org/t/how-to-stop-menu-activation-for-a-control/104160
Comment 1 Mike Kaganski 2024-03-31 15:13:26 UTC
Created attachment 193417 [details]
A simpler self-contained reproducer

This is a document with a single textbox; its "when losing focus" event is bound to this macro:

sub OnFocusLost(evt)
  doc = ThisComponent
  src = evt.Source
  drawPage = doc.DrawPages(0)
  txtbox = drawPage(0)
  drawPage.remove(txtbox)
end sub
Comment 2 Julien Nabet 2024-04-01 08:11:43 UTC
Created attachment 193421 [details]
bt with console logs

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 3 Julien Nabet 2024-04-01 09:19:35 UTC
Caolán: backtrace and console logs show a pb in vcl part.

Do you think it may be possible to have more info than:
warn:legacy.osl:28560:28560:vcl/source/window/window.cxx:309: Window ( 4Edit()) with live SystemWindows destroyed:  18MenuFloatingWindow()
Window ( 4Edit()) with live SystemWindows destroyed:  18MenuFloatingWindow()

to pinpoint the location of the problematic code?