Delete last character of text on path Debug build/flatpak
Steps to reproduce:
- Open inkscape (flatpak or recent debug build)
- create some text
- create a path
- put text on path
- select all the text (in the text tool mode)
- Delete
What happened?
Crash
/usr/include/c++/7/bits/stl_vector.h:875: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::front() [with _Tp = Inkscape::Text::Layout::Paragraph; _Alloc = std::allocator<Inkscape::Text::Layout::Paragraph>; std::vector<_Tp, _Alloc>::reference = Inkscape::Text::Layout::Paragraph&]: Assertion '__builtin_expect(!this->empty(), true)' failed.
Thread 1 "inkscape" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007ffff414ce97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff414e801 in __GI_abort () at abort.c:79
#2 0x00007ffff69308e0 in std::__replacement_assert(char const*, int, char const*, char const*) (__file=__file@entry=0x7ffff759f7c8 "/usr/include/c++/7/bits/stl_vector.h", __line=__line@entry=875, __function=__function@entry=0x7ffff771a880 <std::vector<Inkscape::Text::Layout::Paragraph, std::allocator<Inkscape::Text::Layout::Paragraph> >::front()::__PRETTY_FUNCTION__> "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::front() [with _Tp = Inkscape::Text::Layout::Paragraph; _Alloc = std::allocator<Inkscape::Text::Layout::Paragraph>; std::vector<_Tp, _Alloc"..., __condition=__condition@entry=0x7ffff759fd38 "__builtin_expect(!this->empty(), true)") at /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:472
#3 0x00007ffff738d320 in std::vector<Inkscape::Text::Layout::Paragraph, std::allocator<Inkscape::Text::Layout::Paragraph> >::front() (this=0x55555752c358) at /usr/include/c++/7/bits/stl_vector.h:875
#4 0x00007ffff738d320 in Inkscape::Text::Layout::fitToPathAlign(SVGLength const&, Path const&) (this=this@entry=0x55555752c2a0, startOffset=..., path=...) at ../src/libnrtype/Layout-TNG-Output.cpp:670
#5 0x00007ffff6caa67e in SPText::rebuildLayout() (this=0x55555752c020) at ../src/object/sp-text.cpp:838
#6 0x00007ffff7323535 in te_update_layout_now(SPItem*) (item=item@entry=0x55555752c020) at ../src/text-editing.cpp:60
#7 0x00007ffff732a998 in sp_te_delete(SPItem*, Inkscape::Text::Layout::iterator const&, Inkscape::Text::Layout::iterator const&, std::pair<Inkscape::Text::Layout::iterator, Inkscape::Text::Layout::iterator>&) (item=0x55555752c020, start=..., end=..., iter_pair={...}) at ../src/text-editing.cpp:863
#8 0x00007ffff6e6569f in Inkscape::UI::Tools::TextTool::root_handler(_GdkEvent*) (this=0x555558b77610, event=<optimised out>) at ../src/ui/tools/text-tool.cpp:980
#9 0x00007ffff6e68b4d in Inkscape::UI::Tools::sp_event_context_virtual_root_handler(Inkscape::UI::Tools::ToolBase*, _GdkEvent*) (event_context=event_context@entry=0x555558b77610, event=event@entry=0x555558b7ac60) at ../src/ui/tools/tool-base.cpp:1074
#10 0x00007ffff6e699e6 in Inkscape::UI::Tools::sp_event_context_root_handler(Inkscape::UI::Tools::ToolBase*, _GdkEvent*) (event_context=0x555558b77610, event=event@entry=0x555558b7ac60) at ../src/ui/tools/tool-base.cpp:1062
#11 0x00007ffff721dd4e in sp_desktop_root_handler(SPCanvasItem*, _GdkEvent*, SPDesktop*) (event=0x555558b7ac60, desktop=0x555556598a80) at ../src/desktop-events.cpp:90
#12 0x00007ffff6a9a01b in sp_marshal_BOOLEAN__POINTER(GClosure*, GValue*, guint, GValue const*, gpointer, gpointer) (closure=0x555557afa170, return_value=0x7fffffffd2c0, n_param_values=<optimised out>, param_values=0x7fffffffd1a0, invocation_hint=<optimised out>, marshal_data=<optimised out>) at src/helper/sp-marshal.cpp:120
#13 0x00007ffff1c5710d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007ffff1c6a05e in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff1c720af in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007ffff1c7312f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007ffff6994de5 in SPCanvas::emitEvent(_GdkEvent*) (this=<optimised out>, event=event@entry=0x555558b7abc0) at ../src/display/sp-canvas.cpp:1356
#18 0x00007ffff6994edb in SPCanvas::handle_key_event(_GtkWidget*, _GdkEventKey*) (widget=0x555557a10120, event=0x555558b7abc0) at ../src/display/sp-canvas.cpp:2335
#19 0x00007ffff4ab98f7 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#20 0x00007ffff1c57250 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007ffff1c723cd in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007ffff1c7312f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff4c01534 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#24 0x00007ffff4c21f0b in gtk_window_propagate_key_event () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#25 0x00007ffff4c258fb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#26 0x00007ffff58e7897 in Gtk::Widget::on_key_press_event(_GdkEventKey*) () at /usr/lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
#27 0x00007ffff7341813 in InkscapeWindow::on_key_press_event(_GdkEventKey*) (this=0x555557188be0, event=0x555558b7abc0) at ../src/inkscape-window.cpp:125
#28 0x00007ffff58e9ab4 in Gtk::Widget_Class::key_press_event_callback(_GtkWidget*, _GdkEventKey*) () at /usr/lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
#29 0x00007ffff4ab98f7 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#30 0x00007ffff1c57346 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#31 0x00007ffff1c723cd in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#32 0x00007ffff1c7312f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#33 0x00007ffff4c01534 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#34 0x00007ffff4ab693f in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#35 0x00007ffff4ab8948 in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#36 0x00007fffeebea765 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#37 0x00007fffeec1af92 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#38 0x00007ffff5cd5417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x00007ffff5cd5650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#40 0x00007ffff5cd56dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#41 0x00007ffff1f3de3d in g_application_run () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#42 0x0000555555555518 in main(int, char**) (argc=1, argv=0x7fffffffe008) at ../src/inkscape-main.cpp:67
Crashes at the switch since _paragraphs.size() == 0.
void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
{
double offset = 0.0;
if (startOffset._set) {
if (startOffset.unit == SVGLength::PERCENT)
offset = startOffset.computed * const_cast<Path&>(path).Length();
else
offset = startOffset.computed;
}
switch (_paragraphs.front().alignment) {
case CENTER:
offset -= _getChunkWidth(0) * 0.5;
break;
case RIGHT:
offset -= _getChunkWidth(0);
break;
default:
break;
}
What should have happened?
No crash. Note that if empty text (created in the same fashion, i.e. create some text, delete it) is put on the path, it still has one paragraph and thus no crash.
Inkscape Version and Operating System:
- Inkscape 1.0alpha (7d5df82e, 2019-05-15, custom) debug build, Linux Mint 19.1
- Inkscape 0.92.4 5da689c313, 2019-01-14 flatpak, Linux Mint 19.1