• Michael Stahl's avatar
    tdf#125475 sw: update SwTextFrames when SwTextLine cache shrinks · 774a0185
    Michael Stahl yazdı
    SwCache::DeleteObj() may decide to shrink the cache, and then the
    SwTextFrame::mnCacheIndex goes stale, because only
    SwCacheObj::m_nCachePos is updated.
    
    In this bugdoc, this can happen *inside* SwTextFrame::Format(), where
    first it succeeds to find an existing SwTextLine, then some footnotes
    anchored in this paragraph are moved around and formatted, creating new
    SwTextLines, and SwCache::DeleteObj is called.  Later, any access of the
    original frame's SwTextLine fails to find it and eventually some null
    pointer crash happens.
    
    Newly added SwTextLine::UpdateCachePos() requires that SwTextFrame lives
    longer than its SwTextLine; there was another problem with that, because
    SwTextFrame::FormatEmpty() was throwing away the mnCacheIndex, which
    could then cause a second SwTextLine to be created for the same
    SwTextFrame, and the first one is not deleted until it falls to the
    bottom of the LRU list.
    
    Apprently for this particular document the problem didn't happen before
    commit 3d37463e and/or
    commit 31ae7509 but that is mostly luck.
    
    Reviewed-on: https://gerrit.libreoffice.org/73047
    Tested-by: Jenkins
    Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
    (cherry picked from commit 1424d51a)
    
    Change-Id: I7bef1b340a453d6dd44d51a1dc69ee5fd0b697db
    774a0185
txtfrm.cxx 120 KB