Hi all,

Currently i'm working on issue101666(its details please see  
http://www.openoffice.org/issues/show_bug.cgi?id=101666 ). I found the crash 
point is  that the pointer to SwFlyFrmFmt instance in undo objects was invalid. 
It's because undo object recorded only a pointer of such instance but not a 
copy and SwFlyFrmFmt instance was destroyed after doing hide redline.

For example, undo object recorded a pointer to SwFlyFrmFmt instance.
SwUndoFmtAttr::SwUndoFmtAttr( const SfxPoolItem& rItem, SwFmt& rChgFmt, BOOL 
bSvDrwPt )
    : SwUndo( UNDO_INSFMTATTR ),
      pFmt( &rChgFmt ), // Here, such pointer
      nNode( 0 ),
      nFmtWhich( rChgFmt.Which() ),
      bSaveDrawPt( bSvDrwPt )
{
pOldSet = pFmt->GetAttrSet().Clone( FALSE );
pOldSet->Put( rItem );
Init();
}

But for Undo operate, it should do something but now nothing been done. So from 
here, Office did not reach its expectation.
void SwUndoFmtAttr::Undo( SwUndoIter& rUndoIter)
{
       if( !pOldSet || !pFmt  || !IsFmtInDoc( &rUndoIter.GetDoc() ))
       return; // it should do something below, but it didn't
      ......
}

It crashed when we do the last undo operation because it did not give  test for 
"pFrmFmt" and  unfortunately it was invalid.
void SwUndoInsLayFmt::Undo( SwUndoIter& rUndoIter )
{
     const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); // no test for "pFrmFmt" 
pointer
     ......
}


So my question is that should it be fixed in undo objects or do something about 
the SwFlyFrmFmt instance in redline area? 
For the former i mean we give a copy of SwFlyFrmFmt instance not only a pointer 
to it and this seems simpler compared with the latter one. And for the latter i 
do not familar with redline function but i think it is a complex function. I 
also don't know if the latter method is possible to fix this issue.

Could anybody give me some hints or suggestions? I'd appreciated and thanks 
very much in advance.

Best Regards,
Jun Ma
  • [sw-discussi... MaJun
    • Re: [sw... Oliver-Rainer Wittmann - Software Engineer - Sun Microsystems

Reply via email to