Bug 64639 - Calc chart removeByName crash
Summary: Calc chart removeByName crash
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
PreBibisect
Hardware: All All
: high major
Assignee: Markus Mohrhard
URL:
Whiteboard: target:4.2.0 target:4.1.0.0.beta2 tar...
Keywords: preBibisect, regression
Depends on:
Blocks:
 
Reported: 2013-05-15 14:44 UTC by Jim
Modified: 2022-03-16 11:45 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
please ignore... i got the wrong format (12.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-05-15 15:16 UTC, Jim
Details
example of the problem (12.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-05-15 15:19 UTC, Jim
Details
bt with symbols on master sources (5.62 KB, text/plain)
2013-05-17 21:53 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim 2013-05-15 14:44:33 UTC
Found this when updating to LibreOffice 4.0.2.2 Portable.

I have a macro that removes an existing chart and then creates a new chart in Calc. It works OK in Version 3.6.5.2 Portable.

The problem:
After creating a chart named "aChart" which is visible on the spreadsheet.
Running this code to remove it crashes LibreOffice. 
removeByName() is the problem.

oSheet = ThisComponent.sheets(0)
Charts = oSheet.Charts
if Charts.hasByName("aChart") then Charts.removeByName("aChart")
Comment 1 Joel Madero 2013-05-15 15:13:27 UTC
Please attach the document so we can easily reproduce it. You can strip it down to the bare essentials if there is confidential stuff on it. 

Marking as NEEDINFO - once you attach document mark as UNCONFIRMED and we will investigate. Thanks!
Comment 2 Jim 2013-05-15 15:16:23 UTC
Created attachment 79353 [details]
please ignore... i got the wrong format

the delete chart works if put into into a seperate macro 
but then the create chart fails.
Comment 3 Jim 2013-05-15 15:19:16 UTC
Created attachment 79354 [details]
example of the problem

Put the delete part into a seperate macro which works until you try to  create a new chart
Comment 4 Jim 2013-05-15 15:20:36 UTC
trying to get the ods file into the system.
My first bug report so I'm having a few issues !!
Hoping this is now OK
Comment 5 Joel Madero 2013-05-15 15:22:01 UTC
no worries, thanks for adding it and taking the time to report :) Going to test now
Comment 6 Joel Madero 2013-05-15 15:32:15 UTC
I have been able to confirm the issue with the earliest version of bibisect:
Version 3.6.0.0.alpha1 
Platform: Bodhi Linux 2.2 x64
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
As I've been able to confirm this problem on an earlier release I am changing the version number as version is the earliest version that we can confirm the bug, we use comments to say that the bug exists in newer versions as well.

Marking as:

New (confirmed)
Major - crasher/loss of data
High - default, seems appropriate, despite not affecting a lot of users (maybe?) it's a regression according to OP

Keywords - regression (OP says works in 3.5.4 - I haven't confirmed this)

Whiteboard - PreBibisect

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 7 Julien Nabet 2013-05-17 21:53:13 UTC
Created attachment 79485 [details]
bt with symbols on master sources

On pc Debian x86-64 with master sources updated today, I reproduced the crash.
See bt attached
Comment 8 Julien Nabet 2013-05-17 22:16:10 UTC
Stephan/Kohei/Markus/Eike: Calc problem with Uno part according to the bt, for one of you?
Comment 9 Markus Mohrhard 2013-05-26 22:08:23 UTC
Ok, I'll need to go slowly through the ScChartListener class and related classes. They seem to contain a design flaw when you use the same name for several charts and don't check return values.
Comment 10 Markus Mohrhard 2013-05-26 23:43:14 UTC
Ok, I have found the issue with the API version. I still think that we are "leaking" ScChartListeners when we delete a chart in the UI.
Comment 11 Commit Notification 2013-05-26 23:57:35 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=911186d98f06b43d4563b401244e2cc216b76f33

remove chart listener when chart is deleted, fdo#64639



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 12 Commit Notification 2013-05-27 00:05:40 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

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

remove chart listener when chart is deleted, fdo#64639


It will be available in LibreOffice 4.1.

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 13 Markus Mohrhard 2013-05-27 10:25:37 UTC
Pending review for 3-6 and 4-0
Comment 14 Commit Notification 2013-05-27 13:50:54 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=231707c7ae06ca6dcfc1a8d62472d8a1e18a2b73&h=libreoffice-3-6

remove chart listener when chart is deleted, fdo#64639


It will be available in LibreOffice 3.6.7.

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 15 Commit Notification 2013-05-27 13:51:14 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=92dc9cb50d2d7ebff6fb591d265589ef5f22dc1b&h=libreoffice-4-0

remove chart listener when chart is deleted, fdo#64639


It will be available in LibreOffice 4.0.4.

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 16 Alistair McMillan 2013-06-01 12:54:16 UTC
Downloaded and installed libreoffice-4-0~2013-05-27_17.11.10_LibO-Dev_4.0.4.0_MacOS_x86.dmg.

Opened the example ODS file in LibO-Dev. No crash when following the instructions in the document to create a second chart after the first one was deleted.
Comment 17 Robinson Tryon (qubit) 2015-12-17 11:01:30 UTC Comment hidden (obsolete)
Comment 18 Commit Notification 2022-03-16 11:45:56 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/eae375a224b44cd5bb18e180732668668ee9178f

tdf#64639: sc_macros_test: Add unittest

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