Bug 917602 - Fix some shutdown crashes r=bent
authorFabrice Desré <fabrice@mozilla.com>
Wed, 18 Sep 2013 10:53:07 -0700
changeset 147786 1fce29969d8df0e8d14dde019a88c650b6d24db6
parent 147785 01a4e5ef9aa7782f591ca599970d7d050ecdc0c0
child 147787 39ae127ad4857cc9015b6cfb850770121bcc6c3a
push id2740
push userphilringnalda@gmail.com
push dateThu, 19 Sep 2013 06:32:31 +0000
treeherderfx-team@c40bf17bbc63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs917602
milestone27.0a1
Bug 917602 - Fix some shutdown crashes r=bent
hal/gonk/GonkDiskSpaceWatcher.cpp
hal/gonk/GonkHal.cpp
--- a/hal/gonk/GonkDiskSpaceWatcher.cpp
+++ b/hal/gonk/GonkDiskSpaceWatcher.cpp
@@ -128,17 +128,20 @@ private:
 
 // Helper runnable to delete the watcher on the main thread.
 class DiskSpaceCleaner : public nsRunnable
 {
 public:
   NS_IMETHOD Run()
   {
     MOZ_ASSERT(NS_IsMainThread());
-    delete gHalDiskSpaceWatcher;
+    if (gHalDiskSpaceWatcher) {
+      delete gHalDiskSpaceWatcher;
+      gHalDiskSpaceWatcher = nullptr;
+    }
     return NS_OK;
   }
 };
 
 GonkDiskSpaceWatcher::GonkDiskSpaceWatcher() :
   mLastFreeSpace(UINT64_MAX),
   mIsDiskFull(false),
   mFreeSpace(UINT64_MAX),
--- a/hal/gonk/GonkHal.cpp
+++ b/hal/gonk/GonkHal.cpp
@@ -880,17 +880,17 @@ DestroyAlarmData(void* aData)
 {
   AlarmData* alarmData = static_cast<AlarmData*>(aData);
   delete alarmData;
 }
 
 // Runs on alarm-watcher thread.
 void ShutDownAlarm(int aSigno)
 {
-  if (aSigno == SIGUSR1) {
+  if (aSigno == SIGUSR1 && sAlarmData) {
     sAlarmData->mShuttingDown = true;
   }
   return;
 }
 
 static void*
 WaitForAlarm(void* aData)
 {