After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795014 - Editing register when GTK_IM_MODULE=xim segfaults
Editing register when GTK_IM_MODULE=xim segfaults
Status: RESOLVED INCOMPLETE
Product: GnuCash
Classification: Other
Component: Register
3.0
Other Linux
: Normal normal
: future
Assigned To: gnucash-ui-maint
gnucash-ui-maint
Depends on:
Blocks:
 
 
Reported: 2018-04-05 21:23 UTC by Rémy Oudompheng
Modified: 2018-06-30 00:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rémy Oudompheng 2018-04-05 21:23:03 UTC
Entering any character in the register when GTK_IM_MODULE=xim causes a segfault in Gnucash 3.0

1) Launch gnucash with GTK_IM_MODULE=xim and unset XMODIFIERS
2) Open the register and type any character

The following stack trace is obtained. The cause seems to be a NULL client_window in the GtkIMContextXIM instance.

Thread 1 "gnucash" received signal SIGSEGV, Segmentation fault.
0x00007ffff4315582 in gdk_window_has_impl (window=<optimized out>)
    at gdkwindow.c:677
677	gdkwindow.c: Aucun fichier ou dossier de ce type.
(gdb) bt
  • #0 gdk_window_has_impl
    at gdkwindow.c line 677
  • #1 _gdk_window_has_impl
    at gdkwindow.c line 678
  • #2 gdk_x11_window_get_xid
    at gdkwindow-x11.c line 5566
  • #3 gtk_im_context_xim_filter_keypress
    at gtkimcontextxim.c line 673
  • #4 gtk_im_multicontext_filter_keypress
    at gtkimmulticontext.c line 359
  • #5 gnucash_sheet_key_press_event
    at /build/gnucash/src/gnucash-3.0/gnucash/register/register-gnome/gnucash-sheet.c line 1866
  • #1 _gdk_window_has_impl
    at gdkwindow.c line 678
  • #2 gdk_x11_window_get_xid
    at gdkwindow-x11.c line 5566
  • #3 gtk_im_context_xim_filter_keypress
    at gtkimcontextxim.c line 673
$1 = {object = {parent_instance = {g_type_instance = {g_class = 0x555556bf3bd0}, ref_count = 1, qdata = 0x0}}, im_info = 0x0, 
  locale = 0x555555acbb00 "fr_FR.utf8", mb_charset = 0x555556b382d0 "UTF-8", client_window = 0x0, client_widget = 0x0, 
  status_window = 0x0, preedit_size = 0, preedit_length = 0, preedit_chars = 0x0, feedbacks = 0x0, preedit_cursor = 0, 
  preedit_start_callback = {client_data = 0x0, callback = 0x0}, preedit_done_callback = {client_data = 0x0, callback = 0x0}, 
  preedit_draw_callback = {client_data = 0x0, callback = 0x0}, preedit_caret_callback = {client_data = 0x0, callback = 0x0}, 
  status_start_callback = {client_data = 0x0, callback = 0x0}, status_done_callback = {client_data = 0x0, callback = 0x0}, 
  status_draw_callback = {client_data = 0x0, callback = 0x0}, string_conversion_callback = {client_data = 0x0, 
    callback = 0x0}, ic = 0x0, filter_key_release = 0, use_preedit = 1, finalizing = 0, in_toplevel = 0, has_focus = 1}
Comment 1 John Ralls 2018-04-05 21:38:25 UTC
We need a few more stack frames, but if gnucash_sheet_key_press_event is the only gnucash function between the g_main_loop call and the crash, it's Gtk, not GnuCash, that's causing the crash.
Comment 2 Rémy Oudompheng 2018-04-05 21:53:25 UTC
Here is the full stack:

  • #0 gdk_window_has_impl
    at gdkwindow.c line 677
  • #1 _gdk_window_has_impl
    at gdkwindow.c line 678
  • #2 gdk_x11_window_get_xid
    at gdkwindow-x11.c line 5566
  • #3 gtk_im_context_xim_filter_keypress
    at gtkimcontextxim.c line 673
  • #4 gtk_im_multicontext_filter_keypress
    at gtkimmulticontext.c line 359
  • #5 gnucash_sheet_key_press_event
    at /build/gnucash/src/gnucash-3.0/gnucash/register/register-gnome/gnucash-sheet.c line 1866
  • #6 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 129
  • #7 0x00007ffff65abba1 in
  • #8 g_signal_emit_valist
  • #9 g_signal_emit
  • #10 gtk_widget_event_internal
    at gtkwidget.c line 7740
  • #11 gtk_widget_event
    at gtkwidget.c line 7310
  • #12 gtk_window_propagate_key_event
    at gtkwindow.c line 8161
  • #13 gtk_window_key_press_event
    at gtkwindow.c line 8194
  • #14 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 129
  • #15 0x00007ffff65abc96 in
  • #16 g_signal_emit_valist
  • #17 g_signal_emit
  • #18 gtk_widget_event_internal
    at gtkwidget.c line 7740
  • #19 propagate_event
    at gtkmain.c line 2675
  • #20 gtk_main_do_event
    at gtkmain.c line 1915
  • #21 _gdk_event_emit
    at gdkevents.c line 73
  • #22 gdk_event_source_dispatch
    at gdkeventsource.c line 367
  • #23 g_main_context_dispatch
  • #24 0x00007ffff74eb5b1 in
  • #25 g_main_loop_run
  • #26 gtk_main
    at gtkmain.c line 1323
  • #27 gnc_ui_start_event_loop
    at /build/gnucash/src/gnucash-3.0/gnucash/gnome-utils/gnc-gnome-utils.c line 652
  • #28 inner_main
    at /build/gnucash/src/gnucash-3.0/gnucash/gnucash-bin.c line 670
  • #29 0x00007ffff78149ee in
  • #30 0x00007ffff77f55fa in
  • #31 0x00007ffff787c83d in
  • #32 scm_call_n
  • #33 0x00007ffff786d79b in
  • #34 0x00007ffff77f5c32 in
  • #35 scm_c_with_continuation_barrier
  • #36 0x00007ffff786c1dd in
  • #37 GC_call_with_stack_base
  • #38 scm_with_guile
  • #39 scm_boot_guile
  • #40 main
    at /build/gnucash/src/gnucash-3.0/gnucash/gnucash-bin.c line 810

Comment 3 John Ralls 2018-04-05 22:00:11 UTC
So as I expected, it's just calling the register's key handler... and the first thing that does is call gtk_im_multicontext_filter_keypress, which proceeds to crash.

The Gtk devs will need all sorts of build details about Gtk and maybe GLib, so I suggest that you raise a bug with your distro and let them take it to Gtk. I'll leave this open for a while so that if they want to use it they can.
Comment 4 Rémy Oudompheng 2018-04-05 22:12:00 UTC
Thanks for your answer. It seems that someone already reported it on Gtk side here:
https://gitlab.gnome.org/GNOME/gtk/issues/61
Comment 5 John Ralls 2018-04-05 22:29:49 UTC
OK. That's not in bugzilla and IIRC the original was from the mailing list, so I can't close this as a dupe. I'm a bit at a loss, so I'll go with "incomplete".
Comment 6 John Ralls 2018-06-30 00:07:23 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=795014. Please update any external references or bookmarks.