Issue 111286

Summary: sw: crash when pasting footnote into frame
Product: Writer Reporter: dtardon <dtardon>
Component: codeAssignee: michael.ruess
Status: CLOSED FIXED QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P2 CC: issues, mst.ooo, orw
Version: OOo 3.2Keywords: regression
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
possible fix
none
like this none

Description dtardon 2010-04-30 13:20:15 UTC
How to reproduce:
1. write some text
2. insert a footnote, write some text to the footnote and go back to the document
3. insert a frame
4. select the previously written text including the footnote mark and
   copy it to clipboard
5. click into the frame and paste the content of clipboard
-> crash
Comment 1 dtardon 2010-04-30 13:21:31 UTC
Created attachment 69195 [details]
possible fix
Comment 2 dtardon 2010-04-30 13:42:35 UTC
it was OK in 3.1.1
Comment 3 Oliver-Rainer Wittmann 2010-05-04 15:09:07 UTC
od->dtardon:
Thx, for finding the crash and the attached patch to solve it.
Shall be solved for OOo 3.3

Deeper investigation reveals that the defect has been introduced by cws
odfmetadata3.
Comment 4 Oliver-Rainer Wittmann 2010-05-04 15:32:24 UTC
The attached patch fixes the crash.
But, due to the made changes in cws odfmetadata3 further stuff is broken:
In a version which has the attached patch applied to the following:
- new text document
- write text "AAA BBB CCC"
- insert a footnote after "AAA"
- make "BBB" bold
- insert a text frame
- copy the written text including the footnote and the bold "BBB"
- paste it into the text frame
--> no crash, but the first "B" in the pasted text is not bold.

od->mst: Please take over as you have done the changes to method
<SwTxtNode::CopyText(..)> in cws odfmetadata3.
Before the changes of cws odfmetadata3 have been applied there already exists a
check, if the copied text attribute has been inserted. If not and the text
attribute has no ending index a special character is inserted into the copied
text instead. This code has been also removed by cws odfmetadata3.
Comment 5 Oliver-Rainer Wittmann 2010-05-04 15:43:31 UTC
Further note to the given incorrect behavior:
The first "B" is not bold instead the following blank is bold. Thus, the text
attributes following the not copied footnote are shifted.
Comment 6 dtardon 2010-05-05 09:55:08 UTC
so to shift the following attributes one position back should be enough, right?
Comment 7 dtardon 2010-05-05 09:56:12 UTC
Created attachment 69302 [details]
like this
Comment 8 Oliver-Rainer Wittmann 2010-05-05 10:15:06 UTC
od->dtardon: 
Yes, you are right.
Let wait for mst - he is currently on vacation.
Comment 9 mst.ooo 2010-05-10 18:25:29 UTC
apparently i was unaware that InsertHint could actually fail in this way... i
assumed it could not fail for set of hints that already had been successfully
inserted in another node.

thanks for the patch dtardon!

[actually i am surprised to find that InsertHint with SETATTR_NOTXTATRCHR will
remove a dummy character that it hasn't inserted itself... but in this case i
guess it's needed.]

fixed in cws sw33bf04
http://hg.services.openoffice.org/hg/cws/sw33bf04/rev/2bdf873c4a7f

while looking at the CopyText function i've also finally removed a block of code
with one of the most ridiculous comments in the whole writer code... "best not
to touch it before the BETA", indeed :)
http://hg.services.openoffice.org/hg/cws/sw33bf04/rev/07cdc75d3922
Comment 10 mst.ooo 2010-05-27 11:10:26 UTC
please verify
Comment 11 mst.ooo 2010-05-27 11:12:52 UTC
.
Comment 12 michael.ruess 2010-06-02 12:42:09 UTC
Verified fix in CWS sw33bf04.
Comment 13 michael.ruess 2010-06-10 15:27:08 UTC
*** Issue 112285 has been marked as a duplicate of this issue. ***
Comment 14 eric.savary 2010-06-14 10:34:56 UTC
*** Issue 112353 has been marked as a duplicate of this issue. ***
Comment 15 caolanm 2010-06-17 20:44:52 UTC
closing, integrated m82
Comment 16 eric.savary 2010-07-22 07:52:56 UTC
*** Issue 113351 has been marked as a duplicate of this issue. ***
Comment 17 michael.ruess 2010-10-14 14:55:52 UTC
*** Issue 115059 has been marked as a duplicate of this issue. ***
Comment 18 eric.savary 2010-10-14 14:58:47 UTC
*** Issue 115059 has been marked as a duplicate of this issue. ***