Bug 412160: Cancel in-progress safebrowsing updates on shutdown. r=tony, blocking=schrep
authordcamp@mozilla.com
Mon, 14 Jan 2008 13:13:43 -0800
changeset 10262 63a24f081916b720480800d69d1604bc8ad03494
parent 10261 15e27c78b54c9d2865165f458226d95145b8a036
child 10263 59b218ca5f5dd62a663f6418e27e64737d7bbb1e
push idunknown
push userunknown
push dateunknown
reviewerstony
bugs412160
milestone1.9b3pre
Bug 412160: Cancel in-progress safebrowsing updates on shutdown. r=tony, blocking=schrep
toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
--- a/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
@@ -2243,35 +2243,39 @@ nsUrlClassifierDBServiceWorker::ResetDat
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsUrlClassifierDBServiceWorker::CancelUpdate()
 {
   LOG(("CancelUpdate"));
 
-  mUpdateStatus = NS_BINDING_ABORTED;
-
-  mConnection->RollbackTransaction();
-  mUpdateObserver->UpdateError(mUpdateStatus);
-
-  ResetStream();
-  ResetUpdate();
+  if (mUpdateObserver) {
+    mUpdateStatus = NS_BINDING_ABORTED;
+
+    mConnection->RollbackTransaction();
+    mUpdateObserver->UpdateError(mUpdateStatus);
+
+    ResetStream();
+    ResetUpdate();
+  }
 
   return NS_OK;
 }
 
 // Allows the main thread to delete the connection which may be in
 // a background thread.
 // XXX This could be turned into a single shutdown event so the logic
 // is simpler in nsUrlClassifierDBService::Shutdown.
 NS_IMETHODIMP
 nsUrlClassifierDBServiceWorker::CloseDb()
 {
   if (mConnection) {
+    CancelUpdate();
+
     mMainStore.Close();
     mPendingSubStore.Close();
 
     mGetChunkListsStatement = nsnull;
     mSetChunkListsStatement = nsnull;
 
     mGetTablesStatement = nsnull;
     mGetTableIdStatement = nsnull;