From b2f1558be8722aa26324c372aeaa4c4827674eef 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 e446388ee08d..1f2253bd41f2 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) {