Open jmacloue opened 4 years ago
Can you provide me with a backtrace, please? I've tried to reproduce this, but cannot.
Can you provide me with a backtrace, please? I've tried to reproduce this, but cannot.
Hm-m, that's strange - I have the same issue consistently on three workstations (all Slackware64-current). Among other things it means that my configuration (almost identical) may be to blame for this, so I need to review it first.
And, of all the possible stack traces, which one would be the most useful?
To my understanding, it could be that gVim receives a BadMatch event actually intended to something /under/ its window: like, root window trying to get focus back and not expecting this to fail. Sorry if it is utter heresy, I'm not a programmer. But if I am correct - the answer may lie in stack traces issued by gVim (and all underlying Gtk3 multi-threaded orchestra), main FVWM process, or FvwmPager. Posting all three would certainly be an overkill.
And, of all the possible stack traces, which one would be the most useful?
If it's vim which is crashing, that'll definitely help me. Any/all strack traces which are coredumping will help, especially if it's FVWM.
Sorry, did too much reading on the matter to post a proper bug report. Let's start from the way to reproduce.
OS details:
./configure --prefix=/opt/jmcl --enable-mandoc "CFLAGS=-g -O2 -fPIC" --libdir=/opt/jmcl/lib64 --enable-debug-msgs --disable-perllib
./configure --prefix=/opt/jmcl/ --enable-multibyte --with-features=huge --with-x --enable-gui=gtk3 "CFLAGS=-g -O2 -fPIC" STRIP=/bin/true
Steps to reproduce:
/opt/jmcl/bin/fvm -f /opt/jmcl/share/fvwm/default-config/config
/opt/jmcl/bin/vim -f -g
BadMatch (invalid parameter attributes) Vim: Got X error Vim: Finished.
**Details**
gdb's `threads apply all bt` after Vim exited is not particularly interesting:
Thread 3 (Thread 0x7fffe962e700 (LWP 3738)):
fvwmorg/fvwm#1 0x00007ffff5fbf964 in () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#2 0x00007ffff5fbfce2 in g_main_loop_run () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#3 0x00007ffff65db986 in () at /usr/lib64/libgio-2.0.so.0 fvwmorg/fvwm#4 0x00007ffff5fe5275 in () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#5 0x00007fffed7fc684 in start_thread () at /lib64/libpthread.so.0 fvwmorg/fvwm#6 0x00007ffff4774eed in clone () at /lib64/libc.so.6
Thread 2 (Thread 0x7fffe9e2f700 (LWP 3737)):
fvwmorg/fvwm#1 0x00007ffff5fbf964 in () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#2 0x00007ffff5fbfa6c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#3 0x00007ffff5fbfaa9 in () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#4 0x00007ffff5fe5275 in () at /usr/lib64/libglib-2.0.so.0 fvwmorg/fvwm#5 0x00007fffed7fc684 in start_thread () at /lib64/libpthread.so.0 fvwmorg/fvwm#6 0x00007ffff4774eed in clone () at /lib64/libc.so.6
Thread 1 (Thread 0x7ffff7f81900 (LWP 3733)):
fvwmorg/fvwm#1 0x0000000000518fc8 in mch_exit (r=r@entry=1) at os_unix.c:3360
fvwmorg/fvwm#2 0x0000000000612b59 in getout (exitval=exitval@entry=1) at main.c:1708
fvwmorg/fvwm#3 0x00000000004dfce1 in preserve_exit () at misc1.c:2151
fvwmorg/fvwm#4 0x00000000005160dc in x_error_handler (dpy=
(just indicates Vim received an X error which triggered an unclean exit, no indication on what was the request that caused the error)
I have tried using xscope to get the X11 exchange that led to the error - here's the event dump:
[xscope-vim.txt.gz](https://github.com/fvwmorg/fvwm/files/4053094/xscope-vim.txt.gz)
(note an exchange at the end of file - SetInputFocus to parent and subsequent BadMatch - supposedly as the target is not visible)
Must be some kind of race condition as with GDK_SYNCHRONIZE=1 the error doesn't happen, and sometimes (very rare - 5% of time) it takes more than one Alt-Tab to crash Vim. Here's xscope output taken with GDK_SYNCHRONIZE=1 in the same scenario:
[xscope-sync.txt.gz](https://github.com/fvwmorg/fvwm/files/4053093/xscope-sync.txt.gz)
Also when the WindowList menu pops outside of gVim window - Alt-Tab doesn't crash gVim.
Using mouse binding to show WindowList works the same as Alt-Tab: almost always a crash when it paints over gVim, works without a crash if outside gVim.
To re-iterate, nothing I have seen so far indicates that the issue is isolated to Vim, looks more a general Gtk3 problem with FVWM.
PS I have used Xephyr in a window to run the tests: `Xephyr -screen 1024x768 :2`, with xscope in front of it: `xscope -i1 -o2`, and set DISPLAY to ":1".
PPS And, no, GDK_SYNCHRONIZE=1 is not a proper fix and not too good a workaround.
Perfect. Thank you -- I'll try and get round to looking at this soon.
I'm moving this to the fvwm3
repository so I don't lose it -- any fixes I have, I will backport to fvwm2
, as it's a common bug in the core.
Possibly related to fvwmorg/fvwm#59
I'm using Slackware64-current, FVWM 2.6.9 and Vim 8.2.0050 - both sufficiently recent though not the bleeding edge. FVWM configured with 4 desktops with 2x2 screens.
gVim is built with Gtk3 GUI and works as expected most of the time - until I try to Alt-Tab to another desktop and WindowList is drawn over gVim window. The xscope output is as follows:
As far as I understand, it happens as follows. WindowList steals the input focus and informs gVim of it by sending a PartiallyObscured NotifyEvent, and as gVim tries to get it back from it - it is no longer visible as another desktop is already shown, which is in line with X11 Proto spec .
According to gVim bug #1392, Gtk3 is already handling this scenario by guarding XSetInputFocus() invocation but somehow it is not enough for FVWM.
Alt-Tabbing over the same desktop works as expected, so I believe it is related to how FVWM implements multiple desktops. Though I don't see such problems with other Gtk3 applications - it looks quite generic so it may surface elsewhere as well, and a fix or a good workaround would certainly be nice: maybe guarding XSetInputFocus() in
fvwm/focus.c
same as Gtk3 does?PS Previous gVim version built against Gtk2 does not have this problem - most likely building current gVim against Gtk2 will also "fix" - or, rather, obscure it, but eventually Gtk2 will become obsolete.