Issue 74780

Summary: Crash on Undo of merging cells in complex table
Product: Writer Reporter: michael.ruess
Component: editingAssignee: michael.ruess
Status: CLOSED FIXED QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P2 CC: chengxiuzhi, issues, liujiaxiang, liuyu
Version: 680m203   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 72764    
Attachments:
Description Flags
Sample document
none
patch file
none
patch file none

Description michael.ruess 2007-02-22 15:20:57 UTC
Open attached document, merge cells B2.1.1 and B2.1.2, Undo -> crash
Comment 1 michael.ruess 2007-02-22 15:24:43 UTC
Created attachment 43278 [details]
Sample document
Comment 2 michael.ruess 2007-02-26 09:07:51 UTC
Changing Prio to P2.
Comment 3 andreas.martens 2007-02-27 11:26:48 UTC
The bookmark in the merged cell causes the trouble.I will wait until swnewtable
is integrated before I fix the problem to minimize resync effort.
Comment 4 liuyu 2007-12-18 11:28:01 UTC
Created attachment 50415 [details]
patch file
Comment 5 liuyu 2007-12-18 11:32:52 UTC
liuyu->ama: This patch solved crash, but after undoing something wrong in the 
SwBookmarks. I am trying to fix it.
Comment 6 andreas.martens 2007-12-18 14:19:13 UTC
This patch would cause a memory leak because these (bookmark) undo objects will
never be destroyed. You will need to collect them and call their undo/redo at
the right moment within the SwUndoTblMerge object.
Comment 7 liuyu 2007-12-19 08:28:05 UTC
Created attachment 50453 [details]
patch file
Comment 8 liuyu 2007-12-19 08:50:05 UTC
liuyu->ama: Please have a look at the new patch.
I found that the node index of the node which contains the bookmark named 
'howtouse' is 35 before merging the two table boxes, and it is 27 after merging,
I know that's because of the moving of this node when merging. But it is 30 
when undoing the merging( after moving the node to the position before 
merging). So the bookmark(howtouse) would be inserted to a wrong postion.
Why it is not 35, same as its index before? 
Is the reason of the different index the deleted bookmark?
Comment 9 andreas.martens 2007-12-19 15:25:56 UTC
ama->liuyu:
the problem is a quiet strange behavior of the SwUndoTblMerge. It has its own
list of undo operations (SwUndoMove) which are not in the normal undo stack. On
the other side the bookmark manipulations are recorded on the normal undo stack.
This does not fit together. So the idea of your patch to redo the recorded
bookmark-undos point in the right direction even this patch would work perfectly.
But I found another, radical solution. First I removed the
SwUndoTblMerge::MoveBoxCntnt(SwPaM ..) method. It was only called in tblsel.cxx
and I changed this, too. So now we cannot crash in this function any longer ;-)
Instead of this I use the SwUndoTblMerge::MoveBoxCntnt(SwDoc*...) function. We
lost only a crude behavior of old tables which nobody really needed or understood.
So far, so good. But even this other method has problems caused by the bookmark
undo objects. My solution is to disable the undo recording inside
SwUndoTblMerge::MoveBoxCntnt(..) and all works fine!
 
Comment 10 andreas.martens 2007-12-19 15:27:02 UTC
Fixed in CWS sw8u10bf04
undobj.hxx
untbl.cxx
tblsel.cxx
Comment 11 andreas.martens 2008-01-07 13:20:27 UTC
Ready for QA.
Comment 12 michael.ruess 2008-01-08 15:36:58 UTC
Verified fix in CWS sw8u10bf04.
Comment 13 michael.ruess 2008-02-21 14:56:14 UTC
Checked fix in SRC680m245 and OOH680m7.