Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View fix-gui-gtk-fork-issue.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;
}
jingzhe commented

should be:

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

What do you mean?

jingzhe commented

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.

Owner
mattn commented

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.