Bug 889231 - [Bluetooth] Lock-up occurs when you make a call in no signal network state, r=echou
authorBen Tian <btian@mozilla.com>
Tue, 02 Jul 2013 16:53:21 +0800
changeset 137207 f0a3fca0967452c8229e11498e4a589fcf18b214
parent 137206 2eddca08eac08d7e69afd9e23bdc3db5689057ab
child 137208 1e8dda00db4031554f2c58fafbde2c41ae482a83
push id1823
push userryanvm@gmail.com
push dateWed, 03 Jul 2013 13:15:22 +0000
treeherderfx-team@2cae857c17cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs889231
milestone25.0a1
Bug 889231 - [Bluetooth] Lock-up occurs when you make a call in no signal network state, r=echou
dom/bluetooth/BluetoothTelephonyListener.cpp
--- a/dom/bluetooth/BluetoothTelephonyListener.cpp
+++ b/dom/bluetooth/BluetoothTelephonyListener.cpp
@@ -63,25 +63,29 @@ TelephonyListener::EnumerateCallState(ui
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyListener::NotifyError(int32_t aCallIndex,
                                const nsAString& aError)
 {
   BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
-  // In order to not miss any related call state transition.
-  // It's possible that 3G network signal lost for unknown reason.
-  // If a call is released abnormally, NotifyError() will be called,
-  // instead of CallStateChanged(). We need to reset the call array state
-  // via setting CALL_STATE_DISCONNECTED
-  hfp->HandleCallStateChanged(aCallIndex,
-                              nsITelephonyProvider::CALL_STATE_DISCONNECTED,
-                              EmptyString(), false, true);
-  NS_WARNING("Reset the call state due to call transition ends abnormally");
+
+  if (aCallIndex > 0) {
+    // In order to not miss any related call state transition.
+    // It's possible that 3G network signal lost for unknown reason.
+    // If a call is released abnormally, NotifyError() will be called,
+    // instead of CallStateChanged(). We need to reset the call array state
+    // via setting CALL_STATE_DISCONNECTED
+    hfp->HandleCallStateChanged(aCallIndex,
+                                nsITelephonyProvider::CALL_STATE_DISCONNECTED,
+                                EmptyString(), false, true);
+    NS_WARNING("Reset the call state due to call transition ends abnormally");
+  }
+
   NS_WARNING(NS_ConvertUTF16toUTF8(aError).get());
   return NS_OK;
 }
 
 } // anonymous namespace
 
 BluetoothTelephonyListener::BluetoothTelephonyListener()
 {