Bug 597715 - xpcshell test test_service_sync_checkServerError.js crash [@ mozilla::scache::StartupCache::WriteToDisk()] r=dwitte a=blocking2.0
authorBenedict Hsieh <bhsieh@mozilla.com>
Thu, 23 Sep 2010 14:45:26 -0700
changeset 55145 416db086984109c66012d94c75129a0b350fee08
parent 55144 40ea53a130a3de35849b99c762921762bbbfa3e1
child 55146 b5744e9dd0f09b2ba3ca92d9fcc02c52ea0c7c2d
push id16138
push userdholbert@mozilla.com
push dateThu, 07 Oct 2010 19:37:42 +0000
treeherdermozilla-central@416db0869841 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwitte, blocking2.0
bugs597715
milestone2.0b8pre
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 597715 - xpcshell test test_service_sync_checkServerError.js crash [@ mozilla::scache::StartupCache::WriteToDisk()] r=dwitte a=blocking2.0
startupcache/StartupCache.cpp
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -99,28 +99,33 @@ nsresult
 StartupCache::InitSingleton() 
 {
   nsresult rv;
   StartupCache::gStartupCache = new StartupCache();
 
   rv = StartupCache::gStartupCache->Init();
   if (NS_FAILED(rv)) {
     delete StartupCache::gStartupCache;
+    StartupCache::gStartupCache = nsnull;
   }
   return rv;
 }
 
 StartupCache* StartupCache::gStartupCache;
 PRBool StartupCache::gShutdownInitiated;
 
 StartupCache::StartupCache() 
   : mArchive(NULL), mStartupWriteInitiated(PR_FALSE) { }
 
 StartupCache::~StartupCache() 
 {
+  if (mTimer) {
+    mTimer->Cancel();
+  }
+
   // Generally, the in-memory table should be empty here,
   // but in special cases (like Talos Ts tests) we
   // could shut down before we write.
   // This mechanism will change when IO is moved off-thread
   // (bug 586859) or when Talos first-run is changed to allow
   // our timer to work (bug 591471).
   WriteToDisk();
   gStartupCache = nsnull;