Skip to content

Crash removing both id and style using the XML editor

Summary:

Inkscape crashes if the style attribute of an object is removed after removing its id. Regression from 1.4.x

Steps to reproduce:

  • open Inkscape
  • create a rectangle
  • remove its id using the XML Editor
  • remove the style attribute

What happened?

Crash

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid

Thread 1 "inkscape-dev" received signal SIGABRT, Aborted.
Downloading source file /usr/src/debug/glibc-2.40-3.fc41.x86_64/nptl/pthread_kill.c
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44                                                     
44	     return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
Detailed Backtrace
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff2a80793 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x00007ffff2a27d0e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff2a0f942 in __GI_abort () at abort.c:79
#4  0x00007ffff2c09da9 in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#5  0x00007ffff2c1bc2c in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0x00007ffff2c09951 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:58
#7  0x00007ffff2c1beb8 in __cxxabiv1::__cxa_throw
    (obj=<optimized out>, tinfo=0x7ffff2e53cd8 <typeinfo for std::logic_error>, dest=0x7ffff2c312e0 <std::logic_error::~logic_error()>)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:98
#8  0x00007ffff2c0c632 in std::__throw_logic_error (__s=__s@entry=0x2036a0 "basic_string: construction from null is not valid")
    at ../../../../../libstdc++-v3/src/c++11/functexcept.cc:70
#9  0x00000000002055fe in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >
    (this=<optimized out>, __s=<optimized out>, __a=<optimized out>) at /usr/include/c++/14/bits/basic_string.h:651
#10 0x00007ffff7a7b3ba in objects_query_fillstroke (objects=std::vector of length 1, capacity 1 = {...}, style_res=0x7fffffffa8e0, isfill=isfill@entry=true)
    at /home/krir17/Programs/inkscape_code/inkscape/src/desktop-style.cpp:569
#11 0x00007ffff7a7bd50 in sp_desktop_query_style_from_list (list=std::vector of length 1, capacity 1 = {...}, style=<optimized out>, property=<optimized out>)
    at /home/krir17/Programs/inkscape_code/inkscape/src/desktop-style.cpp:1780
#12 0x00007ffff7a7bf31 in sp_desktop_query_style (desktop=<optimized out>, style=<optimized out>, style@entry=0x7fffffffa8e0, property=<optimized out>)
    at /home/krir17/Programs/inkscape_code/inkscape/src/desktop-style.cpp:1842
#13 0x00007ffff79f1a4e in Inkscape::UI::Widget::SelectedStyle::update (this=0x12dbee0) at /home/krir17/Programs/inkscape_code/inkscape/src/ui/widget/selected-style.cpp:741
#14 0x00007ffff79f2ba6 in ss_selection_changed (data=<optimized out>) at /home/krir17/Programs/inkscape_code/inkscape/src/ui/widget/selected-style.cpp:102
#15 0x00007ffff79f2bbe in ss_selection_modified (selection=<optimized out>, flags=<optimized out>, data=<optimized out>)
    at /home/krir17/Programs/inkscape_code/inkscape/src/ui/widget/selected-style.cpp:110
#16 0x00007ffff79f6eb4 in std::__invoke_impl<void, void (* const&)(Inkscape::Selection*, unsigned int, void*), Inkscape::Selection* const&, unsigned int const&, void* const&> (__f=@0x7ffff51ddaa8: 0x841f0f) at /usr/include/c++/14/bits/invoke.h:61
#17 std::__invoke<void (* const&)(Inkscape::Selection*, unsigned int, void*), Inkscape::Selection* const&, unsigned int const&, void* const&>
    (__fn=@0x7ffff51ddaa8: 0x841f0f) at /usr/include/c++/14/bits/invoke.h:96
#18 std::invoke<void (* const&)(Inkscape::Selection*, unsigned int, void*), Inkscape::Selection* const&, unsigned int const&, void* const&> (__fn=@0x7ffff51ddaa8: 0x841f0f)
    at /usr/include/c++/14/functional:120
#19 sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)>::operator() (this=0x7ffff51ddaa8, a#0=<optimized out>, a#1=<optimized out>, a#2=<optimized out>)
    at /usr/include/sigc++-3.0/sigc++/functors/ptr_fun.h:98
#20 std::__invoke_impl<void, sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)>&, Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> (__f=...) at /usr/include/c++/14/bits/invoke.h:61
#21 std::__invoke<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)>&, Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> (__fn=...) at /usr/include/c++/14/bits/invoke.h:96
#22 std::invoke<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)>&, Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> (__fn=...) at /usr/include/c++/14/functional:120
#23 sigc::adaptor_functor<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)> >::operator()<Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> (this=0x7ffff51ddaa8) at /usr/include/sigc++-3.0/sigc++/adaptors/adaptor_trait.h:100
#24 std::__invoke_impl<void, sigc::adaptor_functor<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)> >&, Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> (__f=...) at /usr/include/c++/14/bits/invoke.h:61
#25 std::__invoke<sigc::adaptor_functor<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)> >&, Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> (__fn=...) at /usr/include/c++/14/bits/invoke.h:96
#26 std::__apply_impl<sigc::adaptor_functor<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)> >&, std::tuple<Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> const&, 0ul, 1ul, 2ul> (__f=..., __t=std::tuple containing = {...}) at /usr/include/c++/14/tuple:2921
#27 0x00007ffff79f6efe in std::apply<sigc::adaptor_functor<sigc::pointer_functor<void(Inkscape::Selection*, unsigned int, void*)> >&, std::tuple<Inkscape::Selection* const&, unsigned int const&, Inkscape::UI::Widget::SelectedStyle*&> const&> (__f=..., __t=std::tuple containing = {...}) at /usr/include/c++/14/tuple:2936
#28 sigc::bind_functor<-1, void (*)(Inkscape::Selection*, unsigned int, void*), Inkscape::UI::Widget::SelectedStyle*>::operator()<Inkscape::Selection* const&, unsigned int const&> (this=0x22abba0) at /usr/include/sigc++-3.0/sigc++/adaptors/bind.h:194
#29 0x00007ffff79f6f3b in sigc::internal::slot_call<sigc::bind_functor<-1, void (*)(Inkscape::Selection*, unsigned int, void*), Inkscape::UI::Widget::SelectedStyle*>, void, Inkscape::Selection*, unsigned int>::call_it (rep=<optimized out>, a_#0=@0x7fffffffb970: 0x1237220, a_#1=@0x7fffffffb91c: 9)
    at /usr/include/sigc++-3.0/sigc++/functors/slot.h:154
#30 0x00007ffff7b0412b in sigc::internal::signal_emit<void, void, Inkscape::Selection*, unsigned int>::emit
    (impl=std::shared_ptr<sigc::internal::signal_impl> (use count 2, weak count 18) = {...}, a#0=@0x7fffffffb970: 0x1237220, a#1=@0x7fffffffb91c: 9, 
    a#1@entry=@0x7fffffffb91c: <optimized out>) at /usr/include/sigc++-3.0/sigc++/signal.h:366
#31 0x00007ffff7b0284a in sigc::signal_with_accumulator<void, void, Inkscape::Selection*, unsigned int>::emit
    (this=0x1237428, a#0=@0x7fffffffb970: 0x1237220, a#1=@0x7fffffffb91c: 9) at /usr/include/sigc++-3.0/sigc++/signal.h:493
#32 Inkscape::Selection::_emitModified (this=this@entry=0x1237220, flags=<optimized out>) at /home/krir17/Programs/inkscape_code/inkscape/src/selection.cpp:86
#33 0x00007ffff7b0299d in Inkscape::Selection::_emit_modified (selection=selection@entry=0x1237220) at /home/krir17/Programs/inkscape_code/inkscape/src/selection.cpp:78
#34 0x00007ffff51ddadd in g_idle_dispatch (source=0x1e6fb40, callback=0x7ffff7b0297a <Inkscape::Selection::_emit_modified(Inkscape::Selection*)>, user_data=0x1237220)
    at ../glib/gmain.c:6243
#35 0x00007ffff51d728c in g_main_dispatch (context=0x329c30) at ../glib/gmain.c:3357
#36 g_main_context_dispatch_unlocked (context=0x329c30) at ../glib/gmain.c:4208
#37 0x00007ffff52377b8 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x329c30, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at ../glib/gmain.c:4273
#38 0x00007ffff51d8783 in g_main_context_iteration (context=context@entry=0x329c30, may_block=may_block@entry=1) at ../glib/gmain.c:4338
#39 0x00007ffff46e0dcd in g_application_run (application=0x4571b0 [gtkmm__GtkApplication], argc=<optimized out>, argv=0x2fe8f0) at ../gio/gapplication.c:2715
#40 0x0000000000205348 in main (argc=<optimized out>, argv=<optimized out>) at /usr/include/c++/14/bits/shared_ptr_base.h:1666

What should have happened?

No crash

Version info

Inkscape 1.5-dev (c9335a4d41, 2024-12-29)

                      Compile  (Run)
    GLib version:     2.82.2
    GTK version:      4.16.3 (4.16.3)
    glibmm version:   2.82.0
    gtkmm version:    4.16.0
    libxml2 version:  2.12.8
    libxslt version:  1.1.42
    Cairo version:    1.18.0 (1.18.0)
    Pango version:    1.54.0 (1.54.0)
    HarfBuzz version: 9.0.0 (9.0.0)
    Poppler version:  24.08.0

    OS version:       Fedora Linux 41 (Workstation Edition)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information