Bug 1336005 - Add null check when releasing and shutting down background thread r=francois
authorThomas Nguyen <tnguyen@mozilla.com>
Tue, 07 Feb 2017 10:06:21 +0800
changeset 341108 ce39540ba30ffe06bd6042d990f5aa806f4dfc86
parent 341107 3a6b42b3d2335f99d68d1e63ac6bb04a8ec78b4c
child 341109 2ff48b77d380c9c649d2f5f1d54b4f5c5b3340ad
push id86634
push usercbook@mozilla.com
push dateTue, 07 Feb 2017 13:14:58 +0000
treeherdermozilla-inbound@9dbd2d9b334e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1336005
milestone54.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 1336005 - Add null check when releasing and shutting down background thread r=francois MozReview-Commit-ID: HKlQLqQH2c9
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1887,16 +1887,21 @@ nsUrlClassifierDBService::Observe(nsISup
   } else if (!strcmp(aTopic, "quit-application")) {
     Shutdown();
   } else if (!strcmp(aTopic, "profile-before-change")) {
     // Unit test does not receive "quit-application",
     // need call shutdown in this case
     Shutdown();
     LOG(("joining background thread"));
     mWorkerProxy = nullptr;
+
+    if (!gDbBackgroundThread) {
+      return NS_OK;
+    }
+
     nsIThread *backgroundThread = gDbBackgroundThread;
     gDbBackgroundThread = nullptr;
     backgroundThread->Shutdown();
     NS_RELEASE(backgroundThread);
   } else {
     return NS_ERROR_UNEXPECTED;
   }