You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2012/05/11 09:21:33 UTC

[Bug 118877] [From Symphony] Calc crashes when Redo refreshing data

https://issues.apache.org/ooo/show_bug.cgi?id=118877

Lei Debin <de...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |debin.lei@gmail.com

--- Comment #1 from Lei Debin <de...@gmail.com> ---
The root cause is using an invalid pointer.
The source code is located at main\sc\source\core\data\table3.cxx
In void ScTable::SwapRow(SCROW nRow1, SCROW nRow2) method,
      const ScPatternAttr* pPat1 = GetPattern(nCol, nRow1);
      const ScPatternAttr* pPat2 = GetPattern(nCol, nRow2);
      if (pPat1 != pPat2)
      {
    SetPattern(nCol, nRow1, *pPat2, TRUE);
    SetPattern(nCol, nRow2, *pPat1, TRUE);
      }
sometimes, pPat1 will be deleted in SetPattern(nCol, nRow1, *pPat2, TRUE);(if
pPat2 point to the same content as pPat1) So when execute SetPattern(nCol,
nRow2, *pPat1, TRUE); it will use a deleted object, crashed !!!

The solution is to check the content refer by the pointer instead of the
pointer itself. The ScPatternAttr had a function ==
int __EXPORT ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const
{
    // #i62090# Use quick comparison between ScPatternAttr's ItemSets

    return ( EqualPatternSets( GetItemSet(), static_cast<const
ScPatternAttr&>(rCmp).GetItemSet() ) &&
             StrCmp( GetStyleName(), static_cast<const
ScPatternAttr&>(rCmp).GetStyleName() ) );
}

-- 
You are receiving this mail because:
You are the assignee for the bug.