unhrefObject warnings on quit when file uses markers in symbol (1.2-dev)

Steps to reproduce:

  1. Open single_insert.svg (dxf file import)
  2. Quit inkscape

What happened?

** (org.inkscape.Inkscape:652498): CRITICAL **: 06:04:17.780: void SPObject::unhrefObject(SPObject*): assertion 'hrefcount > 0' failed

** (org.inkscape.Inkscape:652498): CRITICAL **: 06:04:17.780: void SPObject::unhrefObject(SPObject*): assertion 'hrefcount > 0' failed

What should have happened?

  • No error messages

Version info

  • Inkscape 1.2-dev (a014301d21, 2022-02-02) Linux Mint 20
  • Bisection points to inkscape@eacf41b1 (looks like the normal quit + mac workaround I re-added triggers the problem).
  • But I realize it also happens in Inkscape 1.1.1 (acc4bf7ffb, 2022-02-03)
commit eacf41b111bdfa7a1d0a9e730c8c7f0ec9037390
Author: Nathan Lee <2431820-nathanal@users.noreply.gitlab.com>
Date:   Thu Jan 20 17:49:41 2022 +1100

    Fix quit when document unsaved
    
    Pointed out by Mike Kowalski, regressed from
    c1616499b18d8feb5341c6208e9d49430b97d36b

Relevant LOC (from src/inkscape-application.cpp)

void
InkscapeApplication::on_quit()
{
    if (gtk_app()) {
        if (!destroy_all()) return; // Quit aborted.
        // For mac, ensure closing the gtk_app windows
        for (auto window : gtk_app()->get_windows()) {
            window->close();
        }
    }

    gio_app()->quit();
}
stack when breaking on warning (truncated)
Thread 1 "inkscape" received signal SIGTRAP, Trace/breakpoint trap.
_g_log_abort (breakpoint=1) at ../../../glib/gmessages.c:554
554	in ../../../glib/gmessages.c
(gdb) bt
◊0  _g_log_abort (breakpoint=1) at ../../../glib/gmessages.c:554
◊1  0x00007ffff60eb579 in g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_CRITICAL, format=, args=args@entry=0x7fffffffc8d0)
    at ../../../glib/gmessages.c:1373
◊2  0x00007ffff60eb743 in g_log
    (log_domain=log_domain@entry=0x0, log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7ffff613c8d3 "%s: assertion '%s' failed")
    at ../../../glib/gmessages.c:1415
◊3  0x00007ffff60ebf3d in g_return_if_fail_warning
    (log_domain=log_domain@entry=0x0, pretty_function=pretty_function@entry=0x7ffff7a68e30 "void SPObject::unhrefObject(SPObject*)", expression=expression@entry=0x7ffff7a6852d "hrefcount > 0") at ../../../glib/gmessages.c:2771
◊4  0x00007ffff70042f9 in SPObject::unhrefObject(SPObject*) (this=0x555555e65800, owner=, owner@entry=0x555556e7be90) at ../src/object/sp-object.cpp:295
◊5  0x00007ffff7016ff7 in sp_shape_marker_release(SPObject*, SPShape*) (marker=0x555555e65800, shape=0x555556e7be90) at ../src/object/sp-shape.cpp:1065
◊6  0x00007ffff701da4f in sigc::pointer_functor2::operator()(SPObject* const&, SPShape* const&) const
    (_A_a2=, _A_a1=, this=) at /usr/include/sigc++-2.0/sigc++/functors/ptr_fun.h:146
◊7  sigc::adaptor_functor >::operator()(SPObject* const&, SPShape*&) const
    (_A_arg2=, _A_arg1=, this=) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:108
◊8  sigc::bind_functor<1, sigc::pointer_functor2, SPShape*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::operator()(SPObject* const&) (_A_arg1=, this=) at /usr/include/sigc++-2.0/sigc++/adaptors/bind.h:357
◊9  sigc::internal::slot_call1, SPShape*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, void, SPObject*>::call_it(sigc::internal::slot_rep*, SPObject* const&) (rep=, a_1=)
    at /usr/include/sigc++-2.0/sigc++/functors/slot.h:170
◊10 0x00007ffff6f30314 in sigc::slot1::operator()(SPObject* const&) const (_A_a1=, this=)
    at /usr/include/sigc++-2.0/sigc++/functors/slot_base.h:335
◊11 sigc::adaptor_functor >::operator()(SPObject* const&) const (_A_arg1=, this=) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:89
◊12 sigc::internal::slot_call, void, SPObject*>::call_it(sigc::internal::slot_rep*, SPObject* const&) (rep=, a_◊0=) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:451
◊13 0x00007ffff7004810 in sigc::internal::signal_emit1::emit(sigc::internal::signal_impl*, SPObject* const&)
    (_A_a1=@0x7fffffffca28: 0x555555e65800, impl=0x555556e54980) at /usr/include/sigc++-2.0/sigc++/functors/slot_base.h:335
◊14 sigc::signal1::emit(SPObject* const&) const (_A_a1=@0x7fffffffca28: 0x555555e65800, this=0x555555e65898)
    at /usr/include/sigc++-2.0/sigc++/signal.h:2955
◊15 SPObject::releaseReferences() (this=this@entry=0x555555e65800) at ../src/object/sp-object.cpp:901
◊16 0x00007ffff70067fd in SPObject::detach(SPObject*) (this=this@entry=0x555556a5a660, object=0x555555e65800) at ../src/object/sp-object.cpp:633
◊17 0x00007ffff7006af4 in SPObject::release() (this=0x555556a5a660) at ../src/object/sp-object.cpp:713
◊18 0x00007ffff6f894bb in SPDefs::release() (this=) at ../src/object/sp-defs.cpp:36
◊19 0x00007ffff7004870 in SPObject::releaseReferences() (this=this@entry=0x555556a5a660) at ../src/object/sp-object.cpp:903
◊20 0x00007ffff70067fd in SPObject::detach(SPObject*) (this=this@entry=0x555555d75400, object=0x555556a5a660) at ../src/object/sp-object.cpp:633
◊21 0x00007ffff7006af4 in SPObject::release() (this=this@entry=0x555555d75400) at ../src/object/sp-object.cpp:713
◊22 0x00007ffff6fbfee3 in SPItem::release() (this=this@entry=0x555555d75400) at ../src/object/sp-item.cpp:454
◊23 0x00007ffff6fc6bd0 in SPLPEItem::release() (this=this@entry=0x555555d75400) at ../src/object/sp-lpe-item.cpp:106
◊24 0x00007ffff6fb5387 in SPGroup::release() (this=0x555555d75400) at ../src/object/sp-item-group.cpp:77
◊25 0x00007ffff7015f14 in SPRoot::release() (this=) at ../src/object/sp-root.cpp:97
◊26 0x00007ffff7004870 in SPObject::releaseReferences() (this=0x555555d75400) at ../src/object/sp-object.cpp:903
◊27 0x00007ffff76e8a76 in SPDocument::~SPDocument() (this=0x55555673ac00, __in_chrg=) at ../src/document.cpp:193
◊28 0x00007ffff76e8dfd in SPDocument::~SPDocument() (this=0x55555673ac00, __in_chrg=) at ../src/document.cpp:162
◊29 0x00007ffff77d4b4b in InkscapeApplication::document_close(SPDocument*) (this=this@entry=0x5555555b8a00, document=)
    at ../src/inkscape-application.cpp:339
◊30 0x00007ffff77e1203 in InkscapeApplication::destroy_window(InkscapeWindow*, bool)
    (this=this@entry=0x5555555b8a00, window=, keep_alive=keep_alive@entry=false) at ../src/inkscape-application.cpp:896
◊31 0x00007ffff77e131e in InkscapeApplication::destroy_all() (this=this@entry=0x5555555b8a00) at ../src/inkscape-application.cpp:922
◊32 0x00007ffff77e139e in InkscapeApplication::on_quit() (this=0x5555555b8a00) at ../src/inkscape-application.cpp:1644
◊33 0x00007ffff77e8845 in sigc::bound_mem_functor0::operator()() const (this=)
    at /usr/include/sigc++-2.0/sigc++/limit_reference.h:58
◊34 sigc::adaptor_functor >::operator()() const (this=)
    at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:256
◊35 0x00007ffff77e885b in sigc::internal::slot_call0, void>::call_it(sigc::internal::slot_rep*)
    (rep=) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:132
◊36 0x00007ffff5ff4d64 in sigc::slot1::operator()(Glib::VariantBase const&) const (_A_a1=..., this=0x555555922a08)
    at /usr/include/sigc++-2.0/sigc++/functors/slot_base.h:335
◊37 (anonymous namespace)::SimpleAction_signal_activate_callback(GSimpleAction*, GVariant*, void*) (self=, p0=0x0, data=0x555555922a00)
    at simpleaction.cc:88
◊41 0x00007ffff50050f3 in 
    (instance=instance@entry=0x555555f48140, signal_id=, detail=detail@entry=0) at ../../../gobject/gsignal.c:3555
    ◊38 0x00007ffff4fe5802 in g_closure_invoke (closure=0x555556e46ea0, return_value=0x0, n_param_values=2, param_values=0x7fffffffd170, invocation_hint=0x7fffffffd0f0)
    at ../../../gobject/gclosure.c:810
    ◊39 0x00007ffff4ff9243 in signal_emit_unlocked_R
    (node=node@entry=0x5555558fe040, detail=detail@entry=0, instance=instance@entry=0x555555f48140, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffd170) at ../../../gobject/gsignal.c:3813
    ◊40 0x00007ffff5004bbe in g_signal_emit_valist (instance=, signal_id=, detail=, var_args=var_args@entry=0x7fffffffd340)
    at ../../../gobject/gsignal.c:3499
◊42 0x00007ffff511cf05 in g_simple_action_activate (action=0x555555f48140, parameter=0x0) at ../../../gio/gsimpleaction.c:225
◊43 0x00007ffff5f9046e in Gio::Action_Class::activate_vfunc_callback(_GAction*, _GVariant*) (self=0x555555f48140, parameter=0x0) at action.cc:440
◊44 0x00007ffff3b75932 in gtk_action_muxer_activate_action (action_group=0x55555592bc00, action_name=0x555555a2d8b1 "app.quit", parameter=0x0)
    at ../../../../gtk/gtkactionmuxer.c:413
◊45 0x00007ffff3b75964 in gtk_action_muxer_activate_action (parameter=0x0, action_name=0x555555a2d8b1 "app.quit", action_group=0x555556e4da00)
    at ../../../../gtk/gtkactionmuxer.c:415
◊46 gtk_action_muxer_activate_action (action_group=0x555556e4da00, action_name=0x555555a2d8b1 "app.quit", parameter=0x0) at ../../../../gtk/gtkactionmuxer.c:402
◊47 0x00007ffff3b75964 in gtk_action_muxer_activate_action (parameter=0x0, action_name=0x555555a2d8b1 "app.quit", action_group=0x555559878800)
    at ../../../../gtk/gtkactionmuxer.c:415
Edited by Nathan Lee