From 95076b885deedda49176b0a72a2df08b84b10f34 Mon Sep 17 00:00:00 2001 From: Eric Chou Date: Thu, 16 Aug 2012 10:47:39 +0800 Subject: [PATCH] Bug 782905 - [b2g-bluetooth] Calling setEnabled(false) twice in a very short period may crash, r=qdot --- dom/bluetooth/BluetoothService.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index e446388ee08..1f2253bd41f 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -40,9 +40,11 @@ public: MOZ_ASSERT(NS_IsMainThread()); if (!mEnabled || gInShutdown) { - nsCOMPtr t; - gBluetoothService->mBluetoothCommandThread.swap(t); - t->Shutdown(); + if (gBluetoothService->mBluetoothCommandThread) { + nsCOMPtr t; + gBluetoothService->mBluetoothCommandThread.swap(t); + t->Shutdown(); + } } if (gInShutdown) {