Issue 119941 - [From Symphony] Removing chart in odt file, it causes a crash.
[From Symphony] Removing chart in odt file, it causes a crash.
Status: CLOSED FIXED
Product: General
Classification: Code
Component: chart
OOo 3.3 or older
All All
: P3 major (vote)
: 4.0.0
Assigned To: AOO issues mailing list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-11 02:19 UTC by Shan Zhu
Modified: 2013-07-11 13:32 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
.odt sample file which has 3 charts created with data in table (160.97 KB, application/vnd.oasis.opendocument.text)
2012-06-11 02:19 UTC, Shan Zhu
no flags Details
Add patch (6.41 KB, patch)
2012-06-13 06:56 UTC, Clarence GUO
clarence.guo.bj: review?
Details | Diff
new patch (7.08 KB, patch)
2012-06-21 07:05 UTC, zhaoshzh
aoo.zhaoshzh: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Shan Zhu 2012-06-11 02:19:40 UTC
Created attachment 78223 [details]
.odt sample file which has 3 charts created with data in table

Build info: AOO3.4_1327774

Steps: 
1. Open the .odt sample file (there is three charts created with data in table).
2. Focus on any chart, press Delete/Backspace to remove it, or press Ctrl+X to cut it.

Issue:
Application will crash.
Comment 1 Clarence GUO 2012-06-13 06:56:11 UTC
Created attachment 78285 [details]
Add patch

Root Cause:
When cut or delete the chart, SwUndoFlyBase::DelFly will call SaveSection to store the comtent to strorage. In this step, chart filter functions will be called. And chart filter will call chart core functions to create the chart again. In the new chart2 base, chart core function will call a new class ExplicitCategoryProvider to create data source. In this step, when SW data source provider create the data source, it will create a new SwFlyFrm. But later in SwUndoFlyBase::DelFly, it will clear anchor related attributes of SwFlyFrm. Then finally null pointer occur.

Solution:
In pCnt->RemoveEmbeddedObject in SaveSection process for table chart, only remove the object from the object container, without removing it's storage and graphic stream. The chart already removed from formater.
Comment 2 Armin Le Grand 2012-06-20 12:56:34 UTC
ALG: Please when creating a patch, try to have main as local directory. In this patch, project comphelper and project 'writ' (probably sw) are mixed, the patch cannot easily be applied.
Comment 3 Wang Lei 2012-06-21 02:41:12 UTC
Confirmed in AOO 3.4 Rev 1325589
Comment 4 zhaoshzh 2012-06-21 07:05:32 UTC
Created attachment 78414 [details]
new patch

re-create the patch for this issue.
Comment 5 Armin Le Grand 2012-06-21 15:25:45 UTC
ALG: Works as expected, also checked the code.
Annotation: For bools, it makes no sense to use sal_Bool as long as these will not be involved in transporting over the UNO API, just use standard C++ 'bool'.
Committed as r1352571, thanks for the patch!
Comment 6 Shan Zhu 2012-08-20 05:54:01 UTC
Verified on 0. It works.
Comment 7 Shenfeng Liu 2012-10-09 07:29:22 UTC
set Target Milestone to AOO 3.5.0 for PM purpose.