[gutsy] Vim crash when gnome terminal tab is detached

Bug #129106 reported by kuscsik
4
Affects Status Importance Assigned to Milestone
vim (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

To reproduce this bug:

1. Open a gnome-terminal with several tabs and the vim editor in one of this tabs.
2. Detach the tab by "Tabs>Detach Tab"
3. Stop the vim editor by "CTRL-z" and resume by "fg" command.

Vim will crash with the message:

BadWindow (invalid Window parameter)
Vim: Got X error
Vim: preserving files...
Vim: Finished.

kuscsik (kuscsik)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Re: Vim crash when gnome terminal tab is deatached (Gutsy)

I was able to recreate this bug using vim but not with pico.

Changed in vim:
importance: Undecided → Low
status: New → Triaged
description: updated
Micah Cowan (micahcowan)
description: updated
Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

I can also reproduce this bug on Gutsty. I downloaded the latest
vim-7.1.156 from CVS (with all latest patches) and compiled it myself
and I can still reproduce this problem with this latest vim.

This is vim in a terminal. I think it only uses X for copy/paste or perhaps
mouse support.

If I start vim with "vim -X" (to disable connection to X-server, then it does not crash).

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

When bug happens, vim exits from x_error_handler() without core dump.
I added a call to abort() in x_error_handler() in my CVS sanbox (vim-7.1.156)
to have a core dump and thus see the call stack etc when that bug happens.

(gdb) bt
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7730ca6 in kill () from /lib/tls/i686/cmov/libc.so.6
#2 0x0814a0ce in may_core_dump () at os_unix.c:2951
#3 0x0814a060 in mch_exit (r=1) at os_unix.c:2916
#4 0x080e5565 in getout (exitval=1) at main.c:1342
#5 0x08110836 in preserve_exit () at misc1.c:8349
#6 0x08148341 in deathtrap (sigarg=6) at os_unix.c:1030
#7 <signal handler called>
#8 0xffffe410 in __kernel_vsyscall ()
#9 0xb7730875 in raise () from /lib/tls/i686/cmov/libc.so.6
#10 0xb7732201 in abort () from /lib/tls/i686/cmov/libc.so.6
#11 0x0814879b in x_error_handler (dpy=0x82a8478, error_event=0xbff92cc8) at os_unix.c:1379
#12 0xb7651bfa in _XError () from /usr/lib/libX11.so.6
#13 0xb76536c4 in _XReply () from /usr/lib/libX11.so.6
#14 0xb7637886 in XGetWindowProperty () from /usr/lib/libX11.so.6
#15 0xb7637fce in XGetTextProperty () from /usr/lib/libX11.so.6
#16 0xb76380e3 in XGetWMName () from /usr/lib/libX11.so.6
#17 0x08148cd5 in get_x11_thing (get_title=1, test_only=0) at os_unix.c:1704
#18 0x08148c07 in get_x11_title (test_only=0) at os_unix.c:1665
#19 0x08149087 in mch_settitle (title=0x8292f18 "[Neniu nomo] - VIM", icon=0x8292f30 "[Neniu nomo]") at os_unix.c:1956
#20 0x08057358 in resettitle () at buffer.c:3260
#21 0x080ab57d in ex_stop (eap=0xbff92f60) at ex_docmd.c:6551
#22 0x080a5147 in do_one_cmd (cmdlinep=0xbff930c8, sourcing=1, cstack=0xbff93124, fgetline=0, cookie=0x0)
    at ex_docmd.c:2621
#23 0x080a2997 in do_cmdline (cmdline=0x81f26e4 "st", getline=0, cookie=0x0, flags=11) at ex_docmd.c:1099
#24 0x080a2049 in do_cmdline_cmd (cmd=0x81f26e4 "st") at ex_docmd.c:705
#25 0x0812caef in nv_suspend (cap=0xbff934a8) at normal.c:7513
#26 0x081222c7 in normal_cmd (oap=0xbff93548, toplevel=1) at normal.c:1148
#27 0x080e52a2 in main_loop (cmdwin=0, noexmode=0) at main.c:1181
#28 0x080e4df2 in main (argc=1, argv=0xbff93744) at main.c:940

So the X error handler is called at os_unix.c:1704 when trying to set
the name of the terminal window.

os_unix.c:

1691│ static int
1692│ get_x11_thing(get_title, test_only)
1693│ int get_title; /* get title string */
1694│ int test_only;
1695│ {
1696│ XTextProperty text_prop;
1697│ int retval = FALSE;
1698│ Status status;
1699│
1700│ if (get_x11_windis() == OK)
1701│ {
1702│ /* Get window/icon name if any */
1703│ if (get_title)
1704├> status = XGetWMName(x11_display, x11_window, &text_prop);
1705│ else
1706│ status = XGetWMIconName(x11_display, x11_window, &text_prop);
1707│

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

I came up with a change that appears to fix it. But I don't know
the vim code and X enough to say whether it's the correct way
to fix it. But at least, it no longer crashes.

I only added a call to test_x11_window(x11_display) at line 1698 in os_unix.c:

***************
*** 1695,1701 ****
      int retval = FALSE;
      Status status;

! if (get_x11_windis() == OK)
      {
        /* Get window/icon name if any */
        if (get_title)
--- 1695,1701 ----
      int retval = FALSE;
      Status status;

! if (get_x11_windis() == OK && test_x11_window(x11_display) == OK)
      {
        /* Get window/icon name if any */
        if (get_title)

I will post the patch to the vim_dev mailing list for review.

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :
Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

This is now fixed in vim-7.1 (Patch 166). I don't know in which release of Ubuntu it will be included.

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

As indicated in previous comment, this bug has been fixed in Vim-7.1.166.

This fix has been included in Ubuntu for a while now (I don't know from which release).
Ubuntu-9.10 uses Vim-7.2.245 so at least Ubuntu-9.10 is fixed.

Will Gray (graywh)
Changed in vim (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.