Hi Andreas
Thanks for your reply,but I still have many doubts,please see below words
those marked with RED.
> Hi Talen,
>
> 章华军 wrote:
> > Hello everyone
> > I am a developer from Beijing Redflag CH2000 Software Co.,Ltd.,my name
> > is huajun zhang,you
> > can call me talen,now I am investigating somthing of SW,can be one
> > observer of SW is my
> > pleasure and hope to do many useful job for this project.
> > Recently,I got one issue of SW,detail like below:
> > OS:Windows XP PRO. SP2
> > Language:Anyone
> > Summary:Compare two different *.odt files and delete all of content of
> > those files will crash OO.
> >
> [..]
>
> Yes, it's reproducible. If you compare two documents with complete
> different content, the content of the first document will be marked as
> "deleted" and the content of the second document as "inserted". If you
> reject the insertion and accept the deletion you will got an empty
> document, unfortunately a _very_ empty document and OOo crashes.
> > I tracked the OO process and found,after the OO process deleted the
> > last SwFrm of this document,it will call
pRoot-> SetSuperfluous(),so in the EndAction OO will do RemoveSuperfluous,then
call AdjustRootSize( CHG_CUTPAGE, 0 ),crash
will be happened while ::SetLastPage( (SwPageFrm*)GetPrev() ) in the
AdjustRootSize function,because (SwPageFrm*)GetPrev()
is NULL,so my questions are:
> > 1.Why we need SetSuperfluous in this case,is this a bug of design?
> >
> No, I don't think so, an empty page is superflous and has to be removed.
> A page which contains e.g. an empty paragraph is not empty.
In this case,I think OOo just create one page,after I rejected the insertion
and accepted the deletion I got an empty page,if we set this page as
superfluous and delete it,there is no page in this document,I think maybe this
is why we got NULL from "(SwPageFrm*)GetPrev()".
> > 2.Why we do not create one new SwFrm after we delete the last SwFrm?
> >
> The problem is not the last SwFrm, the main reason is the destruction of
> the last SwTxtNode. Our current model relies on the fact that there is
> always at least one paragraph (empty or not) in the document model (i.d.
> there is a SwTxtNode in the nodes array).
I agree with you,but how(or when) can we ramain at least one paragraph(empty or
not) in design?I have tried to avoid set the page as superfluous,but OOo will
crash while do SwCrsrShell::UpdateCrsrPos() because after do "SwCntntFrm *pFrm
= pCNode ?
pCNode->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() ) :0;" the pFrm
still be NULL(pCNode from this sentence"SwCntntNode *pCNode =
pCurCrsr->GetCntntNode();"),that is why I have this question.
> > 3.What can I do to fix this issue?Now,I add AppenTxtNode function befor
> > delete last SectionNode to create one new SwFrm
and can avoid this issue,but I don't think it's right or complete method for
fixing this issue.
> >
> Yes, this fix would assert that at least one paragraph will remain. But
> this fix would have side-effects, e.g. I imagine that undo would run
> into trouble afterwards.
I have checked AppendTxtNode function,it will append this operation to UNDO
list,and I have tested this change,UNDO or REDO is normal.
Maybe this change will change the construct of the document.
> >
> > Is there anybody can tell me anything about this???
> >
> > Thanks & Best Regards
> > Talen Zhang
> >
> >
> I propose to have a look into the insertion of the change tracks
> (SwDoc::AppendRedline()). It is not allowed that the change tracking
> area covers the whole document. At least one empty paragraph has to be
> outside these change tracks.
I will investigate this function and try to correct my fixing.
> These are my first thoughts about this issue.
Thanks for your reply again,and awaiting your next reply:)
Best Regards
Talen