bug 1276086 set GLib prgname in child process r?glandium
MozReview-Commit-ID: 4Neb36zGScf
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -638,16 +638,18 @@ ContentChild::Init(MessageLoop* aIOLoop,
// to use, and when starting under XWayland, it may choose to start with
// the wayland backend instead of the x11 backend.
// The DISPLAY environment variable is normally set by the parent process.
char* display_name = PR_GetEnv("DISPLAY");
if (display_name) {
int argc = 3;
char option_name[] = "--display";
char* argv[] = {
+ // argv0 is unused because g_set_prgname() was called in
+ // XRE_InitChildProcess().
nullptr,
option_name,
display_name,
nullptr
};
char** argvp = argv;
gtk_init(&argc, &argvp);
} else {
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -482,16 +482,20 @@ XRE_InitChildProcess(int aArgc,
gArgc = aArgc;
#ifdef MOZ_X11
XInitThreads();
#endif
#if MOZ_WIDGET_GTK == 2
XRE_GlibInit();
#endif
+#ifdef MOZ_WIDGET_GTK
+ // Setting the name here avoids the need to pass this through to gtk_init().
+ g_set_prgname(aArgv[0]);
+#endif
#if defined(MOZ_WIDGET_QT)
nsQAppInstance::AddRef();
#endif
#ifdef OS_POSIX
if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS") ||
PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE")) {