Bug 86786 - LibreOffice crashing when a macro is triggered by a change listener
Summary: LibreOffice crashing when a macro is triggered by a change listener
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.3.4.1 release
Hardware: x86-64 (AMD64) All
: medium critical
Assignee: Caolán McNamara
URL:
Whiteboard: target:4.5.0 target:4.4.0.0.beta3
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-27 13:32 UTC by halol
Modified: 2020-11-12 11:22 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample spreadsheet to reproduce the problem (14.70 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-11-27 13:32 UTC, halol
Details

Note You need to log in before you can comment on or make changes to this bug.
Description halol 2014-11-27 13:32:29 UTC
Created attachment 110126 [details]
Sample spreadsheet to reproduce the problem

Description:

I am trying to create a change listener (XModifyListener) and associate it with several cells (not the cell range, since I want the source object of the event to be the modified cell only).

The macro executed creates a new sheet from a template (copyByName).

Actual results:
Depending on the version of LibreOffice and OS I run into various issues...:
- On Linux with 4.3.4.1, LibreOffice simply crashes when the macro completes.
- On Windows with 4.2.5.2, I continuously get the message "Protected cells can not be modified" and I have to forcefully kill LibreOffice.

With the sample spreadsheet that I attached, it looks like I can sometimes modify one cell without running into the error, but it eventually fails on subsequent attempts.

Note: the macro is working perfectly fine when it is not triggered by the listener...

On the more complex spreadsheet that I am working on, I also noticed that the events are triggered when I delete the sheets with the DeleteSheet macro, even though this doesn't modify the cells associated with the listener (but will change other cells in the same sheet).

Steps to reproduce the crash/error with the sample provided:
- open the document.
- run the macro 'AddChangeListener' (this adds a listener on Monitored.A1:A3)
- modify any cell from Monitored.A1:A3
- a new sheet (a cpoy of the 'Template' sheet) should get created.
=> if there is no error/crash, try to modify another value, LO will eventually crash.

Note that you can run the macros 'CreateSheet' and 'DeleteSheet' any number of times without any problem as long as they are not triggered by the listener (so if the macro is executed manually rather than by change the cell value).
Comment 1 raal 2014-11-27 18:59:37 UTC
I can reproduce crash with Version: 4.4.0.0.alpha2+
Build ID: d273a60bfdbf9bb7623bed38667ec0647753157c
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-11-20_03:05:21
Comment 2 Commit Notification 2014-12-09 16:18:53 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1c43d48c62db766ffdf23e8f20ed07cbd7a660ee

Resolves: fdo#86786 take of a copy of the MarkData

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2014-12-09 16:26:56 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=76358a71a937b5af93e4257c0dd0c1cf0e9b7ab7&h=libreoffice-4-4

Resolves: fdo#86786 take of a copy of the MarkData

It will be available in 4.4.0.0.beta3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Caolán McNamara 2014-12-09 16:27:45 UTC
Seems to be ok after that change.