Bug 981126 - Prevent glxtest child process from executing the normal shutdown sequence. r=bgirard, r=jrmuizel
authorViktor Stanchev <vstanchev@mozilla.com>
Wed, 12 Mar 2014 16:32:57 -0400
changeset 173446 d736ff28e9dc97ea92d88954a042facc6f733fc4
parent 173445 4853e04fe2a63354cc0edc9979b09c132b0904be
child 173447 c06738b183790c3863c2b3455ee2d6fd84b1df90
push id26405
push userkwierso@gmail.com
push dateFri, 14 Mar 2014 02:01:11 +0000
treeherdermozilla-central@76a24e33ec2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard, jrmuizel
bugs981126
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 981126 - Prevent glxtest child process from executing the normal shutdown sequence. r=bgirard, r=jrmuizel
toolkit/xre/glxtest.cpp
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/glxtest.cpp
+++ b/toolkit/xre/glxtest.cpp
@@ -255,21 +255,23 @@ bool fire_glxtest_process()
   }
   pid_t pid = fork();
   if (pid < 0) {
       perror("fork");
       close(pfd[0]);
       close(pfd[1]);
       return false;
   }
+  // The child exits early to avoid running the full shutdown sequence and avoid conflicting with threads 
+  // we have already spawned (like the profiler).
   if (pid == 0) {
       close(pfd[0]);
       write_end_of_the_pipe = pfd[1];
       glxtest();
       close(pfd[1]);
-      return true;
+      exit(0);
   }
 
   close(pfd[1]);
   mozilla::widget::glxtest_pipe = pfd[0];
   mozilla::widget::glxtest_pid = pid;
   return false;
 }
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2846,20 +2846,20 @@ XREMain::XRE_mainInit(bool* aExitFlag)
     NS_BREAK();
 #endif
 
 #ifdef USE_GLX_TEST
   // bug 639842 - it's very important to fire this process BEFORE we set up
   // error handling. indeed, this process is expected to be crashy, and we
   // don't want the user to see its crashes. That's the whole reason for
   // doing this in a separate process.
-  if (fire_glxtest_process()) {
-    *aExitFlag = true;
-    return 0;
-  }
+  //
+  // This call will cause a fork and the fork will terminate itself separately
+  // from the usual shutdown sequence
+  fire_glxtest_process();
 #endif
 
 #if defined(XP_WIN) && defined(MOZ_METRO)
   // Don't remove this arg, we want to pass it on to nsUpdateDriver 
   if (CheckArg("metro-update", false, nullptr, false) == ARG_FOUND ||
       XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
     // If we're doing a restart update that was initiated from metro land,
     // we'll be running desktop to handle the actual update. Request that