Crash deleting mask if masked object has a clone. (delete via XML editor)

Steps to reproduce:

  • open Inkscape
  • Create a rectangle (non-black)
  • Duplicate
  • Select both and create a mask
  • Create a clone
  • Open XML editor
  • Select mask in the defs
  • Delete

Or you can just delete the mask in inkscape-crash-delete-mask.svg (using XML editor)

What happened?

What should have happened?

  • No crash

Sample attachments: backtrace: inkscape-backtrace-xml-editor-crash-delete-mask.txt

Version Info:

  • Inkscape 1.2-dev (9c1e195a, 2021-11-17) Linux Mint 20
  • Inkscape 1.1-dev (57575ffd, 2020-08-26) Linux Mint 20
  • Inkscape 1.0 (4035a4fb, 2020-05-01) appimage Linux Mint 20

Bisection points to 2b9eeffa

commit 2b9eeffadbce92b9aa38e3edd9211329b0ec8c97
Author: Tavmjong Bah <tavmjong@free.fr>
Date:   Thu Oct 24 18:21:53 2019 +0200

    Fix gradient/mesh handles after object with gradient/mesh cloned.
    Fixes https://bugs.launchpad.net/inkscape/+bug/453067
    Fixes https://gitlab.com/inkscape/inkscape/issues/130

Checked open issues in inbox and inkscape, search term crash, and label inbox~15959740 respectively

Edited by Nathan Lee