- Package:
- scim-gtk-immodule
- Source:
- scim-gtk-immodule
- Description:
- GTK+ input method module, with SCIM as the input backend
- Submitter:
- Michal Byrecki
- Date:
- 2023-08-13 10:15:03 UTC
- Severity:
- normal
Dear Maintainer,
I have recently updated Debian distribution to the Bookworm. After update, I've
noticed that clicking on 'Find' button crashes Nautilus.
I am working on a graphical environment with three monitors in-use.
Please find the last lines of strace below:
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8,
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD,
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
getpid() = 36400
newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, st_size=2654,
...}, 0) = 0
write(2, "\n(org.gnome.Nautilus:36400): GLi"..., 146
(org.gnome.Nautilus:36400): GLib-GObject-WARNING **: 14:58:48.769: invalid cast
from 'GdkWaylandToplevel' to 'GdkX11Surface'
) = 146
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8,
c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD,
c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
getpid() = 36400
newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, st_size=2654,
...}, 0) = 0
write(2, "\n(org.gnome.Nautilus:36400): GLi"..., 145
(org.gnome.Nautilus:36400): GLib-GObject-WARNING **: 14:58:48.770: invalid cast
from 'GdkWaylandDisplay' to 'GdkX11Display'
) = 145
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x826e8} ---
+++ killed by SIGSEGV +++
Howdy, I've just found another app with a same problem: gnome-calculator. At a first glance it looks like some library inconsistency... Here's the strace output for gnome-calculator:
I've found a solution to run either nautilus or gnome calculator by invoking: GDK_BACKEND=x11 <app name> Cheers Mike
Control: tags -1 + moreinfo nautilus and gnome-calculator are working fine for me in a Wayland environment, without a similar warning, and without needing GDK_BACKEND=x11. Do you have any LD_PRELOAD modules or other plugins that are injecting additional code into processes in your session? Please try running nautilus (or another affected program) with G_DEBUG=fatal-warnings in the environment (which will turn this warning into a crash that can be debugged), and use either gdb or systemd-coredump to get a backtrace from that crash: https://wiki.debian.org/HowToGetABacktrace Thanks, smcv
Indeed, running an application not stripped with symbols provides much more info :) Here's the backtrace from gdb, it crashes on clicking the magnifyier icon:
It seems to be kernel and my hardware related My hardware setup is: And I've been running kernel 5.13.0 which worked fine for me in bullseye. I haven't been switching to the 6.1 which comes with Bookworm, as I preffered to stick to the kernel tailored to my needs. I had the feeling that switching to the 6.1 that comes with distro may bring some more perspective. And indeed, my NVidia monitor is dark., I have to take care of the drivers (5.13.0 used nouveau module). I've managed to run Debian on two screens with integrated GPU, and the bug is gone. I suspect the problem lays somewhere in between the (old) kernel drivers and the Debian libraries. What I am gonna do is to setup NVidia driver for 6.1 kernel and get back with the results. Below is a full backtrace with symbols:
Control: retitle -1 scim-gtk-immodule: assumes windowing system is X11, segfaults if not
Control: reassign -1 scim-gtk-immodule 1.4.18+git20211204-0.1
Control: affects -1 + src:gtk4
Control: severity -1 important
These warnings indicate that a component is assuming that all windows
are X11 windows, and all displays are X11 displays; and that's also the
cause of the segfault, while calling XGetWindowAttributes on something
that is not a valid X11 window (probably a null pointer dereference).
This component seems to be the one that is making that assumption.
The bug affects multiple GTK 4 apps because it's a module that has been
loaded into GTK 4.
Looking at scim-gtk-immodule's GTK 4 code in
<https://github.com/scim-im/scim/commit/d35bf5d331d885e94914fea6eab9c56f20666c8d>,
it does things like this:
compiled into GTK, that doesn't mean it is the one currently in use. The
GdkDisplay object might be a GdkX11Display, but equally it might be a
GdkWaylandDisplay. (That's why GDK_BACKEND=x11 is a workaround for this,
because when that environment variable is set, the X11 windowing system
*is* the one in use.)
I haven't checked what scim-gtk-immodule does for GTK 3, but if it has the
same pattern there, it would be equally problematic for GTK 3.
The correct pattern is more like this:
GdkDisplay *display;
if (widget != NULL) {
display = gtk_widget_get_display (widget));
} else {
display = gdk_display_get_default ();
}
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display) {
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
/* ... do X11 things with x11_display ... */
}
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (display) {
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
/* ... do Wayland things with wayland_display ... */
}
#endif
Until scim-gtk-immodule is fixed, the workaround would be to either set
GDK_BACKEND=x11, or use an X11 desktop environment or a desktop environment
in X11 mode (like the "GNOME (Xorg)" option for GNOME), or remove
scim-gtk-immodule and use a different input method framework such as ibus.
ibus is the input method framework recommended by GNOME upstream. I can't
read or write any of the languages supported by scim myself, but many of
the input methods available for scim seem to be available for ibus too,
for example ibus-anthy seems to be the ibus equivalent of scim-anthy.
smcv
Thank You Simon for Your support! I saw You re-addressed the bug to the right package. I've also found there is something wrong with nouveau driver itself. Whenever I run my old 5.13 kernel I have three monitors active. When I boot the 6.1 kernel from Bookworm distro, the nouveau output is blank with a white screen. When I've tried to swap nouveau driver with nvidia from nvidia-kernel- dkms package - it worked, but the signal was only on the nvidia output (1 monitor out of 3). The intel GPU outputs remained off. But that's another story, to be addressed elsewhere. Perhaps to a kernel developers. Brgds Mike
Thank you very much for the explanation. I have tried to fix the scim-gtk-immodule upstream but although the x11 window issue is addressed there are still other problems. It seems that it is impossible to get the global coordinates for a widget in wayland so it is difficult to place the "candidate window" alongside with the input cursor in the correct position. I am investigating it and hope that I can find a way to address it soon. Thanks, Tz-Huan