tdf#155685 sw: fix another ExtendedSelectAll Redo crash w table at end
commita398e3eb78783dfe533b55b6f174d76265ea422b
authorMichael Stahl <michael.stahl@allotropia.de>
Thu, 15 Jun 2023 10:22:11 +0000 (15 12:22 +0200)
committerMichael Stahl <michael.stahl@allotropia.de>
Thu, 15 Jun 2023 18:08:34 +0000 (15 20:08 +0200)
tree1ebc7afaf50f958b719d537b5efe0a240e9c7b4f
parent7ef2a697b7daa3338febd98057241b57cf7722b3
tdf#155685 sw: fix another ExtendedSelectAll Redo crash w table at end

This can be reproduced with a table containing in the last cell a
paragraph followed by a table, then ExtendedSelectAll in the cell and
delete.

On Redo of the SwUndoDelete:

  warn:legacy.osl:326138:326138:sw/source/core/frmedt/tblsel.cxx:1775: MakeSelUnions with pStart or pEnd not in CellFrame
  In function:
    const_reference std::vector<SwTableBox *>::operator[](size_type) const
    [_Tp = SwTableBox *, _Allocator = std::allocator<SwTableBox *>]
  Error: attempt to subscript container with out-of-bounds index 0, but
  container only holds 0 elements.

The problem is that DelTable() calls PaMCorrAbs() with a target that is
outside of the outer table, so the SwEditShell::DeleteSel() rPam has one
end in the last table cell and other end outside the table.

Change-Id: Ia2764a4c99ba12102957153e005284a44be04fd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153114
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 4ef548a672658ab164e45e45ebd1b9f0b9282019)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153088
sw/qa/extras/uiwriter/data/table-at-end-of-cell.fodt [new file with mode: 0644]
sw/qa/extras/uiwriter/uiwriter.cxx
sw/source/core/docnode/ndtbl.cxx