Apache OpenOffice (AOO) Bugzilla – Issue 82227
Undo Convert Table to Text Crashes Writer
Last modified: 2013-08-07 14:42:49 UTC
Select the table in the attached document. Convert it to text. Convert the text back to a table. Undo Undo again and OpenOffice Writer crashes. Confirmed three times.
Created attachment 48680 [details] Table That Causes Crash with Undo
Reproduced in m231.
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.
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 SwTable::CreateSelection. What do you think?
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.
Created attachment 49663 [details] patch file
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.
ama->liuyu: 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 ;-)
Fixed in CWS sw8u10bf01 untbl.cxx
Ready for QA.
Verified in cws sw8u10bf01
Verified in OOo 3.0 - closing - Sophie