On Ubuntu 12.04, GTK Gvim doesn't work properly.

1,212 views
Skip to first unread message

Yukihiro Nakadaira

unread,
Apr 29, 2012, 5:28:27 AM4/29/12
to vim...@googlegroups.com
After upgrading my pc to Ubuntu 12.04, gvim breaks.

When starting gvim, it freeze abount 1 or 2 minutes after showing GUI
Window. Menus is not shown in global menu bar, it is shown in Vim's
window. Input Method (ibus) doesn't work in gvim.

With -f flag, gvim works normally.

I also tested it with clean installed Ubuntu 12.04 and vim-gtk package.

I guess that it is caused by calling gtk_init_check() before fork().

Perhaps the following code should be removed. I'm not sure if it is
correct fix.


diff -r 1be42b88900e src/main.c
--- a/src/main.c Thu Apr 26 20:17:03 2012 +0200
+++ b/src/main.c Sun Apr 29 18:04:21 2012 +0900
@@ -359,25 +359,6 @@
*/
#ifdef ALWAYS_USE_GUI
gui.starting = TRUE;
-#else
-# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
- /*
- * Check if the GUI can be started. Reset gui.starting if not.
- * Don't know about other systems, stay on the safe side and don't check.
- */
- if (gui.starting)
- {
- if (gui_init_check() == FAIL)
- {
- gui.starting = FALSE;
-
- /* When running "evim" or "gvim -y" we need the menus, exit if we
- * don't have them. */
- if (params.evim_mode)
- mch_exit(1);
- }
- }
-# endif
#endif

if (GARGCOUNT > 0)



--
Yukihiro Nakadaira - yukihiro....@gmail.com

Bram Moolenaar

unread,
Apr 29, 2012, 6:57:02 AM4/29/12
to Yukihiro Nakadaira, vim...@googlegroups.com

Yukihiro Nakadaira wrote:

> After upgrading my pc to Ubuntu 12.04, gvim breaks.
>
> When starting gvim, it freeze abount 1 or 2 minutes after showing GUI
> Window. Menus is not shown in global menu bar, it is shown in Vim's
> window. Input Method (ibus) doesn't work in gvim.
>
> With -f flag, gvim works normally.
>
> I also tested it with clean installed Ubuntu 12.04 and vim-gtk package.
>
> I guess that it is caused by calling gtk_init_check() before fork().
>
> Perhaps the following code should be removed. I'm not sure if it is
> correct fix.

Simply deleting that code is not right. Can you see where in
gui_init_check() Vim hangs?

I suppose it's not Ubuntu 12.04 itself but a later version of the GTK
libraries.

--
BRIDGEKEEPER: What is your favorite editor?
GAWAIN: Emacs ... No, Viiiiiiiiiiimmmmmmm!
"Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Yukihiro Nakadaira

unread,
Apr 29, 2012, 7:19:30 AM4/29/12
to Bram Moolenaar, vim...@googlegroups.com
gui_init_check() itself doesn't hang.
After initializing GUI, Vim hangs in gui_mch_update().
I think "gtk_init_check() -> fork() -> gui_mch_update()" causes hang.

Here is backtrace with "gdb vim <pid>" while vim is hanging.

I found same issue in Ubuntu's bug tracker.
[gvim in Precise can't connect to ibus and takes a long time to load]
https://bugs.launchpad.net/ubuntu/+source/vim/+bug/987707

(gdb) bt
#0 0x00007f1fcea8fb03 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f1fd04bbff6 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007f1fd04bc45a in g_main_loop_run () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007f1fcde2388d in
g_dbus_connection_send_message_with_reply_sync () from
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4 0x00007f1fcde23c90 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#5 0x00007f1fcde25a28 in g_dbus_connection_call_sync () from
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#6 0x00007f1fcde25cd6 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#7 0x00007f1fcddc128f in g_initable_new_valist () from
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#8 0x00007f1fcddc1379 in g_initable_new () from
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#9 0x00007f1fcde243df in g_dbus_connection_new_for_address_sync ()
from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#10 0x00007f1fc1b32d02 in ?? () from /usr/lib/x86_64-linux-gnu/libibus-1.0.so.0
#11 0x00007f1fc1b32e4d in ?? () from /usr/lib/x86_64-linux-gnu/libibus-1.0.so.0
#12 0x00007f1fd0799957 in g_type_create_instance () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007f1fd077e0b9 in ?? () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007f1fc1b30deb in ?? () from /usr/lib/x86_64-linux-gnu/libibus-1.0.so.0
#15 0x00007f1fd077fc02 in g_object_newv () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007f1fd07801ec in g_object_new () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007f1fc1b30e3a in ibus_bus_new () from
/usr/lib/x86_64-linux-gnu/libibus-1.0.so.0
#18 0x00007f1fc1d5d09a in ?? () from
/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so
#19 0x00007f1fd0797627 in g_type_class_ref () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007f1fd077fcac in g_object_newv () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007f1fd07801ec in g_object_new () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007f1fc1d5db62 in ibus_im_context_new () from
/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so
#23 0x00007f1fd11f1526 in ?? () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#24 0x00007f1fd11f1e09 in ?? () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#25 0x00007f1fd11f1fe1 in ?? () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#26 0x0000000000567615 in gui_focus_change (in_focus=1) at gui.c:4726
#27 0x000000000056e9ee in focus_in_event (widget=0x23a2360,
event=<optimized out>, data=<optimized out>) at gui_gtk_x11.c:777
#28 0x00007f1fd1209dd8 in ?? () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#29 0x00007f1fd0778ca2 in g_closure_invoke () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#30 0x00007f1fd0789d71 in ?? () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#31 0x00007f1fd0791d7e in g_signal_emit_valist () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#32 0x00007f1fd0792242 in g_signal_emit () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#33 0x00007f1fd1324191 in ?? () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#34 0x00007f1fd12084fb in gtk_main_do_event () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#35 0x00007f1fd0e7ccac in ?? () from
/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#36 0x00007f1fd04bbc9a in g_main_context_dispatch () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007f1fd04bc060 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007f1fd04bc124 in g_main_context_iteration () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x0000000000571d95 in gui_mch_update () at gui_gtk_x11.c:5339
#40 0x0000000000571dc7 in gui_mch_set_shellsize (width=580,
height=494, min_width=<optimized out>, min_height=<optimized out>,
base_width=<optimized out>, base_height=<optimized out>, direction=15)
at gui_gtk_x11.c:3927
#41 0x0000000000565d71 in gui_set_shellsize (mustset=<optimized out>,
fit_to_display=1, direction=15) at gui.c:1615
#42 0x00000000005668e0 in gui_init () at gui.c:707
#43 0x000000000054dfcf in set_termname (term=<optimized out>) at term.c:1776
#44 0x0000000000567b29 in gui_attempt_start () at gui.c:161
#45 0x0000000000567dea in gui_do_fork () at gui.c:293
#46 gui_start () at gui.c:100
#47 0x0000000000410930 in main (argc=<optimized out>, argv=<optimized
out>) at main.c:661

mattn

unread,
May 2, 2012, 9:22:19 AM5/2/12
to vim...@googlegroups.com, Bram Moolenaar
It seems that gtk_init connect to dbus session. Currently, it is called before fork, i.e. parent process.
Parent process quit after the checking gui enable. So dbus session become disconnected.

https://bugs.launchpad.net/ubuntu/+source/vim/+bug/987707

I moved call of gtk_init to child process.

https://gist.github.com/2576464

It seens good to me.

On Sunday, April 29, 2012 8:19:30 PM UTC+9, Yukihiro Nakadaira wrote:
> gui_init_check() itself doesn't hang.
> After initializing GUI, Vim hangs in gui_mch_update().
> I think "gtk_init_check() -> fork() -> gui_mch_update()" causes hang.
>
> Here is backtrace with "gdb vim

Bram Moolenaar

unread,
May 2, 2012, 9:35:12 AM5/2/12
to mattn, vim...@googlegroups.com

Yasuhiro Matsumoto wrote:

> It seems that gtk_init connect to dbus session. Currently, it is
> called before fork, i.e. parent process.
> Parent process quit after the checking gui enable. So dbus session
> become disconnected.
>
> https://bugs.launchpad.net/ubuntu/+source/vim/+bug/987707
>
> I moved call of gtk_init to child process.
>
> https://gist.github.com/2576464
>
> It seens good to me.

Thanks. I just upgraded to 12.04 thus I should be able to verify this
soon.

--
It is illegal to rob a bank and then shoot at the bank teller with a water
pistol.
[real standing law in Louisana, United States of America]

mattn

unread,
May 7, 2012, 10:29:57 PM5/7/12
to vim...@googlegroups.com, mattn
I had mistake in the patch.
Please look newer in same URL.
Reply all
Reply to author
Forward
0 new messages