Debug build crash with flowtext (SVG 1.2) on pressing down after deleting text

Taken from conversation in inbox#6419 (comment 994740203)

Steps to reproduce:

  • open bug_sample.svg in Inkscape
  • Select the bottom text object
  • Select all
  • Backspace
  • Press the down arrow 2-3 times (or press up 2-3 times)

What happened?

  • Crash on assert
/usr/include/c++/9/bits/stl_vector.h:1153: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::back() const [with _Tp = Inkscape::Text::Layout::Chunk; _Alloc = std::allocator<Inkscape::Text::Layout::Chunk>; std::vector<_Tp, _Alloc>::const_reference = const Inkscape::Text::Layout::Chunk&]: Assertion '__builtin_expect(!this->empty(), true)' failed.

Backtrace: oldtext-crash2.txt

What should have happened?

  • no crash

Version info

  • Inkscape 1.3-dev (176b8b6c, 2022-10-14), Inkscape 1.2.1 (e23ecae4, 2022-09-26) Linux Mint 20
  • Introduced between 1.0.x and 1.1.x, bisection points to commit e0dd6e42
commit e0dd6e42d9cb14326f2fb04512ed16b1512f0c72
Author: Marc Jeanmougin <marcjeanmougin@free.fr>
Date:   Wed Apr 29 13:13:52 2020 +0000

    Ignore flowPara without children to be consistent with rendering in previous Inkscape versions
    
    Fixes part of https://gitlab.com/inkscape/inkscape/-/issues/1349
Edited by Nathan Lee