public
Last active

  • Download Gist
fix-gui-gtk-fork-issue.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
diff -r 273fbf501965 src/gui.c
--- a/src/gui.c Mon Apr 30 21:09:43 2012 +0200
+++ b/src/gui.c Tue May 01 19:32:14 2012 +0900
@@ -270,6 +270,12 @@
}
/* Child */
+#ifdef FEAT_GUI_GTK
+ /* Call gtk_init_check() here. See gui_init_check(). */
+ if (gui_mch_init_check() != OK)
+ exit(1);
+#endif
+
# if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
/*
* Change our process group. On some systems/shells a CTRL-C in the
@@ -430,7 +436,16 @@
#ifdef ALWAYS_USE_GUI
result = OK;
#else
+# ifdef FEAT_GUI_GTK
+ /*
+ * Note: Don't call gtk_init(), gtk_init_check() before fork.
+ * This will be called after the fork. When calling that before fork,
+ * it make vim hang for a while. See gui_do_fork().
+ */
+ result = gui.dofork ? OK : gui_mch_init_check();
+# else
result = gui_mch_init_check();
+# endif
#endif
return result;
}

should be:

#ifdef FEAT_GUI_GTK
      /* Call gtk_init_check() here. See gui_init_check(). */
      if (gui_mch_init_check() != OK)
       exit(1);
#endif

What do you mean?

I mean we should use "#ifdef FEAT_GUI_GTK", but not use "#ifndef" in child process.

I tested your patch in Ubuntu 12.04, if change "#ifndef" -> "#ifdef", then everything is Ok.

Ah, I noticed it just now. hehehe.
Thanks for your notice.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.