Bug 1328768 - Always keep the minidump analyzer runnable object alive until we remove the shutdown blocker; r=froydnj, a=lizzard
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 31 Jan 2017 00:41:44 +0100
changeset 375978 bbaed5a7faece9003c1403d1fc5dc0025629b8d2
parent 375977 514a5268030faf927430313a96a9e470e5c14c11
child 375979 05fac47f4f7da5f34cebaa962e2ab7009776801e
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, lizzard
bugs1328768
milestone53.0a2
Bug 1328768 - Always keep the minidump analyzer runnable object alive until we remove the shutdown blocker; r=froydnj, a=lizzard MozReview-Commit-ID: BWm0eQPJQWB
ipc/glue/CrashReporterHost.cpp
--- a/ipc/glue/CrashReporterHost.cpp
+++ b/ipc/glue/CrashReporterHost.cpp
@@ -104,28 +104,31 @@ public:
     if (mProcessType == nsICrashService::PROCESS_TYPE_CONTENT) {
       CrashReporter::RunMinidumpAnalyzer(mChildDumpID);
     }
 
     // Make a copy of these so we can copy them into the runnable lambda
     int32_t processType = mProcessType;
     int32_t crashType = mCrashType;
     nsString childDumpID(mChildDumpID);
+    nsCOMPtr<nsIAsyncShutdownBlocker> self(this);
 
-    NS_DispatchToMainThread(NS_NewRunnableFunction([=] () -> void {
+    NS_DispatchToMainThread(NS_NewRunnableFunction([
+      self, processType, crashType, childDumpID
+    ] {
       nsCOMPtr<nsICrashService> crashService =
         do_GetService("@mozilla.org/crashservice;1");
       if (crashService) {
         crashService->AddCrash(processType, crashType, childDumpID);
       }
 
       nsCOMPtr<nsIAsyncShutdownClient> barrier = GetShutdownBarrier();
 
       if (barrier) {
-        barrier->RemoveBlocker(this);
+        barrier->RemoveBlocker(self);
       }
     }));
 
     return NS_OK;
   }
 
   NS_IMETHOD BlockShutdown(nsIAsyncShutdownClient* aBarrierClient) override
   {