Issue 82227

Summary: Undo Convert Table to Text Crashes Writer
Product: Writer Reporter: pesala <pesala>
Component: editingAssignee: eric.savary
Status: CLOSED FIXED QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P2 CC: chengxiuzhi, issues, liujiaxiang, liuyu, peter.junge
Version: OOo 2.3   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 72764    
Description Flags
Table That Causes Crash with Undo
patch file none

Description pesala 2007-10-03 20:14:17 UTC
Select the table in the attached document.
Convert it to text.
Convert the text back to a table. 
Undo again and OpenOffice Writer crashes. 

Confirmed three times.
Comment 1 pesala 2007-10-03 20:16:46 UTC
Created attachment 48680 [details]
Table That Causes Crash with Undo
Comment 2 eric.savary 2007-10-04 01:59:58 UTC
Reproduced in m231.
Comment 3 pesala 2007-10-04 10:52:21 UTC
It seems from the linked Oo Forum topic thread that this issue relates to old tables or 
imported tables. There is no such problem with a similar table that is created from 
scratch in Oo 2.3. 
Comment 4 liuyu 2007-11-13 13:46:32 UTC
liuyu->ama: I have look at the code about this issue, I find the codes are 
changed in the m228 compared with m196, which resulted this issue.

In m196, in the SwRootFrm::MakeTblCrsrs the wrong "SwTableBox" will be removed 
from the "SwSelBoxes" before "InsertBox".
In m228, I think the SwSelBoxes aSelBoxes contains all the "SwTableBox", the 
right "SwTableBox" and the wrong "SwTableBox".

I try to add a condition of the SwSelBoxes aSelBoxes inserting into the 
SwTableCursor::InsertBox ( if(pBox->GetSttNd()) ). It can solve the crash 
problem, but there're some problems with the cursor in the table after Undo. I 
will try to fix it. I think or maybe I could do some changes in the 

What do you think?
Comment 5 andreas.martens 2007-11-13 14:29:43 UTC
Maybe the solution is much more easy...
If there is an Undo issue with "old" tables we have to check if there is no
old/new mismatch. We introduced a new table model (flag bNewModel at class
SwTable) for OOo2.3. If we open old documents with complex table structure,
these tables will be imported as "old". Any Undo operation has to restore the
same bNewModel flag. I have already fixed some issues regarding this and my
suspicion is that the undo of table-to-text does not restore the right
bNewModel-flag. This could be the root cause for any crashes afterwards. So
please check the bNewModel flag at the SwTable before the text-to-table and
after the undo operation.
Comment 6 liuyu 2007-11-15 02:37:50 UTC
Created attachment 49663 [details]
patch file
Comment 7 liuyu 2007-11-15 03:13:05 UTC
liuyu->ama: I submit the patch, please have a look at it. 
This OOBUG.odt document will also crash when "Split Table", I think it is the 
same reason. Should I creat a new issue or fix it in this issue?
Maybe there are some other operations for "Old Table" resulting this situation.
Comment 8 andreas.martens 2007-11-15 07:39:25 UTC
Thank you for your patch. It works fine and I integrate it into CWS sw8u10bf01.
Regarding the split crash, this is one of the already fixed issues (issue 81755).
It shouldn't occur any longer since milestones oogm6/src680m236.
Maybe I have overlooked other situations but fortunately now we have two
developers who can take care of such issues ;-)
Comment 9 andreas.martens 2007-11-15 07:40:27 UTC
Fixed in CWS sw8u10bf01
Comment 10 andreas.martens 2007-11-20 10:46:50 UTC
Ready for QA.
Comment 11 eric.savary 2007-11-27 13:45:48 UTC
Verified in cws sw8u10bf01
Comment 12 2009-01-02 12:48:46 UTC
Verified in OOo 3.0 - closing - Sophie