Segfault on signal emit

Hi,

My application broke after a weird segfault error; when an involved widget (that belongs to a module plugin, loaded by Glib::Module) is going to emit a signal.

The gdb backtrace stack gives no more info for me,

#0  0x00007fffd8064080 in  ()
#1  0x000055555567363a in sigc::internal::signal_emit<void, void>::emit(std::shared_ptr<sigc::internal::signal_impl> const&) (impl=<optimized out>)
    at /usr/local/include/sigc++-3.0/sigc++/signal.h:366
#2  0x00007fffd810c16a in sigc::signal_with_accumulator<void, void>::emit() const (this=0x5555580c59a8) at /usr/local/include/sigc++-3.0/sigc++/signal.h:454
[...]

Could you suggest something ?

Note:

$ pkg-config --modversion gtk4 gtkmm-4.0 sigc+±3.0
4.10.3
4.10.0
3.2.0

I can only suggest debugging further, or at least showing some of the lead-up the the crash, how that signal is declared and emitted, etc. … since right now, I don’t see how there’s enough info for readers to do much with.

The this pointer appears to be the ascii string :6gUUU Maybe its a coincidence the value is entirely composed of bytes in the ascii range but usually it suggests you’ve corrupted your memory in some way.

Other than that try compiling with debug symbols and creating a reproducible test case

1 Like

Do you ever unload the GLib::module? Post the entire stacktrace as it can help identifying what’s happening

1 Like

The problem is still going… I cannot reach to understand what is its cause.

Here goes the entire debugging backtrace,

#0  0x00007fffd8064020 in  ()
#1  0x000055555567038a in sigc::internal::signal_emit<void, void>::emit(std::shared_ptr<sigc::internal::signal_impl> const&) (impl=<optimized out>)
    at /usr/local/include/sigc++-3.0/sigc++/signal.h:366
#2  0x00007ffff79ef85a in std::__invoke_impl<void, void (*)(sigc::internal::slot_rep*), sigc::internal::slot_rep*&>(std::__invoke_other, void (*&&)(sigc::internal::slot_rep*), sigc::internal::slot_rep*&)
    (__f=@0x7fffffffcc38: 0x7fffd810cb90 <sigc::internal::slot_call<sigc::bound_mem_functor<void (EntryCombo::*)()>, void>::call_it(sigc::internal::slot_rep*)>) at /usr/include/c++/12/bits/invoke.h:61
#3  0x00007ffff79ef7b1 in std::__invoke<void (*)(sigc::internal::slot_rep*), sigc::internal::slot_rep*&>(void (*&&)(sigc::internal::slot_rep*), sigc::internal::slot_rep*&)
    (__fn=@0x7fffffffcc38: 0x7fffd810cb90 <sigc::internal::slot_call<sigc::bound_mem_functor<void (EntryCombo::*)()>, void>::call_it(sigc::internal::slot_rep*)>) at /usr/include/c++/12/bits/invoke.h:96
#4  0x00007ffff79ef703 in std::invoke<void (*)(sigc::internal::slot_rep*), sigc::internal::slot_rep*&>(void (*&&)(sigc::internal::slot_rep*), sigc::internal::slot_rep*&)
    (__fn=@0x7fffffffcc38: 0x7fffd810cb90 <sigc::internal::slot_call<sigc::bound_mem_functor<void (EntryCombo::*)()>, void>::call_it(sigc::internal::slot_rep*)>) at /usr/include/c++/12/functional:110
#5  0x00007ffff79ef685 in sigc::slot<void ()>::operator()() const (this=0x5555580ca1d8) at /usr/local/include/sigc++-3.0/sigc++/functors/slot.h:222
#6  0x00007ffff7f4f415 in Glib::SignalProxyNormal::slot0_void_callback(_GObject*, void*) (self=0x5555580c04f0, data=0x5555580ca1d0)
    at ../subprojects/glibmm/glib/glibmm/signalproxy.cc:92
#7  0x00007ffff73b75a9 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8  0x00007ffff73d0bbf in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9  0x00007ffff73d0dbf in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007ffff73b73b0 in g_closure_invoke () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007ffff73ca076 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#12 0x00007ffff5c1493d in gtk_signal_action_emit_signal
    (error=0x7fffffffd128, handled=<synthetic pointer>, args=<optimized out>, signal=0x7ffff6d8ad22 "activate", widget=0x7fffc0006870)
    at ../gtk/gtkshortcutaction.c:826
#13 gtk_signal_action_activate (action=<optimized out>, flags=<optimized out>, widget=0x7fffc0006870, args=<optimized out>) at ../gtk/gtkshortcutaction.c:858
#14 0x00007ffff5c15d7b in gtk_shortcut_controller_run_controllers
    (x=<optimized out>, y=<optimized out>, enable_mnemonics=<optimized out>, event=0x55555704f920, controller=<optimized out>)
    at ../gtk/gtkshortcutcontroller.c:430
#15 gtk_shortcut_controller_handle_event (controller=<optimized out>, event=0x55555704f920, x=<optimized out>, y=<optimized out>)
    at ../gtk/gtkshortcutcontroller.c:475
#16 0x00007ffff5b3b9a6 in gtk_event_controller_handle_event
    (controller=controller@entry=0x5555580be680, event=event@entry=0x55555704f920, target=target@entry=0x7fffc0006870, x=x@entry=0, y=y@entry=0)
    at ../gtk/gtkeventcontroller.c:362
#17 0x00007ffff5c8e4a8 in gtk_widget_run_controllers
    (widget=widget@entry=0x7fffc0006870, event=event@entry=0x55555704f920, target=target@entry=0x7fffc0006870, x=0, y=0, phase=phase@entry=GTK_PHASE_BUBBLE)
    at ../gtk/gtkwidget.c:4570
#18 0x00007ffff5c95b49 in gtk_widget_event (widget=widget@entry=0x7fffc0006870, event=event@entry=0x55555704f920, target=target@entry=0x7fffc0006870)
    at ../gtk/gtkwidget.c:4764
#19 0x00007ffff5bacc4e in gtk_propagate_event_internal (widget=widget@entry=0x7fffc0006870, event=event@entry=0x55555704f920, topmost=<optimized out>)
    at ../gtk/gtkmain.c:1956
#20 0x00007ffff5baccc7 in gtk_propagate_event (widget=widget@entry=0x7fffc0006870, event=event@entry=0x55555704f920) at ../gtk/gtkmain.c:2006
#21 0x00007ffff5bad203 in gtk_main_do_event (event=0x55555704f920) at ../gtk/gtkmain.c:1698
#22 0x00007ffff5ca1e6c in surface_event (surface=surface@entry=0x55555852a270, event=<optimized out>, widget=widget@entry=0x555556fbca80)
    at ../gtk/gtkwindow.c:4752
#23 0x00007ffff5e11099 in _gdk_marshal_BOOLEAN__POINTER
    (closure=0x5555576a17e0, return_value=0x7fffffffd700, n_param_values=<optimized out>, param_values=0x7fffffffd760, invocation_hint=<optimized out>, marshal_data=<optimized out>) at gdk/gdkmarshalers.c:258
#24 0x00007ffff5e8191f in gdk_surface_event_marshaller
    (closure=0x5555576a17e0, return_value=0x7fffffffd700, n_param_values=2, param_values=0x7fffffffd760, invocation_hint=0x7fffffffd6e0, marshal_data=0x0)
    at ../gdk/gdksurface.c:435
#25 0x00007ffff73b73b0 in g_closure_invoke () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff73ca076 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff73d042d in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#28 0x00007ffff73d0dbf in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#29 0x00007ffff5e84f45 in gdk_surface_handle_event (event=0x55555704f920) at ../gdk/gdksurface.c:2956
#30 0x00007ffff5e534fa in gdk_event_source_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>)
    at ../gdk/x11/gdkeventsource.c:429
#31 0x00007ffff6b3e7a9 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff6b3ea38 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007ffff6b3eacc in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff6cff65d in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#35 0x00007ffff70fac0b in Gio::Application::run(int, char**) (this=0x555555a135a0, argc=1, argv=0x7fffffffe048)
    at subprojects/glibmm/gio/giomm/application.cc:1463
#36 0x00005555557db266 in Gtk::Application::make_window_and_run<MyApp>(int, char**) (this=<optimized out>, argc=argc@entry=1, argv=0xe50f3f42ffcaff00, 
    argv@entry=0x7fffffffe048) at /usr/local/include/gtkmm-4.0/gtkmm/application.h:777
#37 0x00005555557d9fc6 in run_gui_application(int, char**) (argc=1, argv=0x7fffffffe048) at /usr/include/c++/12/bits/shared_ptr_base.h:1665
#38 0x00005555556658aa in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at main.cc:390

Could it be that the GLib::Module is inadvertently destroyed? Try calling GLib::Module::make_resident()

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.