bug 1276086 set GLib prgname in child process r?glandium draft
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 27 May 2016 11:50:26 +1200
changeset 371917 f1338fbdc01d84b5d5d7bb7f48e334d30eb9ce5e
parent 371915 cc72f50cc7fedcdad2d2c9752569344b1f3a3271
child 522051 85e8a1b511a1f15ca967c20df6856a84ee99bc3d
push id19389
push userktomlinson@mozilla.com
push dateFri, 27 May 2016 03:10:14 +0000
reviewersglandium
bugs1276086
milestone49.0a1
bug 1276086 set GLib prgname in child process r?glandium MozReview-Commit-ID: 4Neb36zGScf
dom/ipc/ContentChild.cpp
toolkit/xre/nsEmbedFunctions.cpp
--- 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")) {