Crash copying object with no id.

Steps to reproduce:

  • Open Inkscape
  • Draw a rectangle
  • Open the XML Editor dialog
  • Select the id and delete it
  • Close the dialog (optional)
  • Select the rectangle
  • Copy (Ctrl+C)

What happened?

  • Crash on copy
  • Truncated backtrace:
Thread 1 "inkscape" received signal SIGSEGV, Segmentation fault.
SPObject::getRepr (this=0x0) at ../src/object/sp-object.cpp:239
239	    return repr;
(gdb) set pagination off
(gdb) bt
#0  SPObject::getRepr() (this=0x0) at ../src/object/sp-object.cpp:239
#1  0x00007ffff712586b in Inkscape::UI::ClipboardManagerImpl::_copySelection(Inkscape::ObjectSet*) (this=this@entry=0x55555951e500, selection=selection@entry=0x5555574b5c18) at ../src/ui/clipboard.cpp:920
#2  0x00007ffff712693d in Inkscape::UI::ClipboardManagerImpl::copy(Inkscape::ObjectSet*) (this=0x55555951e500, set=0x5555574b5c18) at ../src/ui/clipboard.cpp:320
#3  0x00007ffff77c4dea in Inkscape::ObjectSet::copy() (this=0x5555574b5c18) at ../src/selection-chemistry.cpp:1326
#4  0x00007ffff783c4e4 in Inkscape::EditVerb::perform(SPAction*, void*) (action=0x5555580f9f20 [SPAction], data=0x14) at ../src/verbs.cpp:968

What should have happened?

  • No crash, object pasted

Debug info

  • Bisection points to ac2151fe
  • Affects Inkscape 1.2-dev (72a0d558, 2021-07-02), Inkscape 1.1 (3a60490d, 2021-06-29), Inkscape 1.1 (c4e8f9ed, 2021-05-24) Linux Mint 20