Skip to content

Instantly share code, notes, and snippets.

@mattn
Created May 2, 2012 13:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/2576464 to your computer and use it in GitHub Desktop.
Save mattn/2576464 to your computer and use it in GitHub Desktop.
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
Copy link

jingzhe commented May 6, 2012

should be:

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

@mattn
Copy link
Author

mattn commented May 7, 2012

What do you mean?

@jingzhe
Copy link

jingzhe commented May 7, 2012

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.

@mattn
Copy link
Author

mattn commented May 7, 2012

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