Bug 782905 - [b2g-bluetooth] Calling setEnabled(false) twice in a very short period may crash, r=qdot
authorEric Chou <echou@mozilla.com>
Thu, 16 Aug 2012 10:47:39 +0800
changeset 107971 cb192b83831c57b6f4eb3bb025ac042211199098
parent 107970 66f381b9547e43b0d6af8f327227948b21bb6709
child 107972 e0f50d6dc61e7ad0740b921c8677f1d57476c99b
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs782905
milestone17.0a1
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 782905 - [b2g-bluetooth] Calling setEnabled(false) twice in a very short period may crash, r=qdot
dom/bluetooth/BluetoothService.cpp
--- a/dom/bluetooth/BluetoothService.cpp
+++ b/dom/bluetooth/BluetoothService.cpp
@@ -35,19 +35,21 @@ public:
   {
   }
   
   NS_IMETHOD Run()
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     if (!mEnabled || gInShutdown) {
-      nsCOMPtr<nsIThread> t;
-      gBluetoothService->mBluetoothCommandThread.swap(t);
-      t->Shutdown();
+      if (gBluetoothService->mBluetoothCommandThread) {
+        nsCOMPtr<nsIThread> t;
+        gBluetoothService->mBluetoothCommandThread.swap(t);
+        t->Shutdown();
+      }
     }
     
     if (gInShutdown) {
       gBluetoothService = nullptr;
     }
 
     return NS_OK;
   }