Bug 993954 - Check sBluetoothChild is null when closing Settings application
authorShawn Huang <shuang@mozilla.com>
Wed, 30 Apr 2014 16:58:15 +0100
changeset 181475 b908160de1acc92d0b95cb2592f45416c5140fc0
parent 181474 eee6cbb254824008f6fa42d320ab843b02762d73
child 181476 a7ba0b16162213db8a77098d9cd661b237fc8519
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
bugs993954
milestone32.0a1
Bug 993954 - Check sBluetoothChild is null when closing Settings application It is possible that sBluetoothChild set to nullptr and RecvNotify get called from MessageLoop. This patch check sBluetoothChild.
dom/bluetooth/ipc/BluetoothChild.cpp
--- a/dom/bluetooth/ipc/BluetoothChild.cpp
+++ b/dom/bluetooth/ipc/BluetoothChild.cpp
@@ -70,26 +70,30 @@ BluetoothChild::ActorDestroy(ActorDestro
 #endif
 }
 
 bool
 BluetoothChild::RecvNotify(const BluetoothSignal& aSignal)
 {
   MOZ_ASSERT(sBluetoothService);
 
-  sBluetoothService->DistributeSignal(aSignal);
+  if (sBluetoothService) {
+    sBluetoothService->DistributeSignal(aSignal);
+  }
   return true;
 }
 
 bool
 BluetoothChild::RecvEnabled(const bool& aEnabled)
 {
   MOZ_ASSERT(sBluetoothService);
 
-  sBluetoothService->SetEnabled(aEnabled);
+  if (sBluetoothService) {
+    sBluetoothService->SetEnabled(aEnabled);
+  }
   return true;
 }
 
 bool
 BluetoothChild::RecvBeginShutdown()
 {
   if (mShutdownState != Running && mShutdownState != SentStopNotifying) {
     MOZ_ASSERT(false, "Bad state!");