Issue 119956

Summary: [From Symphony]Crash if undo redo creating data pilot from imported data
Product: Calc Reporter: Yan Ji <yanji.yj>
Component: editingAssignee: AOO issues mailing list <issues>
Status: CLOSED FIXED QA Contact:
Severity: Critical    
Priority: P3 CC: binbjguo, leiw, liushenf
Version: 3.4.0   
Target Milestone: 4.0.0   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
sample
none
Fix patch for Bug 119956
yunquanp: review?
Fix patch for Bug 119956 yunquanp: review?

Description Yan Ji 2012-06-12 07:07:47 UTC
Created attachment 78250 [details]
sample

Build: AOO3.4
Steps:
1. New a Spreadsheet document
2. From menu "Insert->Sheets from File"
3. Select attached sample file and select all sheet to import
4. Select Data in sheet A to create pivot Table via menu "Data->Pivot Table->Create"
5. In Pivot Table dialog, click "More" button
6. Select "- new sheet" for "Results to"
7. Drag one filed to either layout/Column/Row/Dat field, click "OK"
8. Undo three times
9. Redo three times

Defect: Application crashed
Comment 1 Yan Ji 2012-06-12 07:30:45 UTC
Change product
Comment 2 pengyunquan 2012-06-13 05:25:56 UTC
Created attachment 78276 [details]
Fix patch for Bug 119956

Root Cause : A rule in calc is that inserting a sheet should enable DrawUndo first, because inserting a new sheet will cause a new ScDrawPage being inserted into SdrModel, and this action should be managed by DrawUndo. But on creation of PivotTable, this rule is not obeyed. When creating PivotTable on new sheet, a new sheet is inserted without enablement of DrawUndo. As a result, when undo the creation of PivotTable, the new sheet is removed but the SdrModel is not by synchronized because it's the DrawUndo's responsibility to do the synchronization but DrawUndo is not recorded. When inserting sheets from file for the 2nd time, the undo list is cleared and some ScDrawPage should be destroyed, but as stated above the ScDrawPage is not correctly maintained when undo the creation of PivotTable, so incorrect ScDrawPage is destroyed and cause dead object access later. 

Solution : Enable DrawUndo before inserting a new sheet on creation of PivotTable
Comment 3 pengyunquan 2012-06-13 05:50:01 UTC
Created attachment 78280 [details]
Fix patch for Bug 119956
Comment 4 Wang Lei 2012-06-14 06:26:11 UTC
At first I can not reproduce this bug. Then I find how to reproduce. The reproduce steps should be

Steps:
1. New a Spreadsheet document
2. From menu "Insert->Sheets from File"
3. Select attached sample file and select all sheet to import
4. Select Data in sheet A to create pivot Table via menu "Data->Pivot Table->Create"
5. In Pivot Table dialog, click "More" button
6. Select "- new sheet" for "Results to"
7. Drag one filed to either layout/Column/Row/Dat field, click "OK"
8. Undo three times
9. Redo three times
10. At this time, you may see the redo button is disable. Enter Ctrl+Y again

AOO3.4 will crash
Comment 5 Wang Lei 2012-06-14 06:46:22 UTC
Reviewed.  Patch looks good.
Thanks for the good work.
Applied on SVN revision 1350103
Comment 6 Wang Lei 2012-06-21 02:34:06 UTC
Fixed in revision 1350103
Comment 7 binguo 2012-08-20 09:46:33 UTC
Verified on latest AOO Trunk 0817 build on Window OS/Linux OS/Linux 64bit OS, this bug is fixed. No crash occurs again when undo/redo.
Comment 8 Shenfeng Liu 2012-11-07 08:42:29 UTC
corrected the Target Milestone to AOO 3.5.0.