Bug 1120395 - Deal with shutdown without crashing. r=mmc, r=gcp, a=lmandel
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 04 Feb 2015 14:17:13 -0800
changeset 249655 84030546d4968f064f6758de0989d069f107be23
parent 249654 f29179ce227b10fff495416758a79b4aa3e79f93
child 249656 a7fca11f7b4ce9459bb66c5a8f29f955fb9a1d92
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmmc, gcp, lmandel
bugs1120395
milestone37.0a2
Bug 1120395 - Deal with shutdown without crashing. r=mmc, r=gcp, a=lmandel
toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -488,20 +488,26 @@ nsUrlClassifierStreamUpdater::OnStartReq
         strStatus.AppendInt(requestStatus);
         downloadError = true;
       }
     }
   }
 
   if (downloadError) {
     LOG(("nsUrlClassifierStreamUpdater::Download error [this=%p]", this));
-    mDownloadErrorCallback->HandleEvent(strStatus);
+
+    // It's possible for mDownloadErrorCallback to be null on shutdown.
+    if (mDownloadErrorCallback) {
+      mDownloadErrorCallback->HandleEvent(strStatus);
+    }
+
     mDownloadError = true;
     status = NS_ERROR_ABORT;
   } else if (NS_SUCCEEDED(status)) {
+    MOZ_ASSERT(mDownloadErrorCallback);
     mBeganStream = true;
     LOG(("nsUrlClassifierStreamUpdater::Beginning stream [this=%p]", this));
     rv = mDBService->BeginStream(mStreamTable);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   mStreamTable.Truncate();