From 7f34829d6dcae6eaec62bbae1152445340a250a8 Mon Sep 17 00:00:00 2001 From: Gina Yeh Date: Tue, 26 Feb 2013 18:53:44 +0800 Subject: [PATCH] Bug 844705 - Should send socket data in main thread, r=echou --- dom/bluetooth/BluetoothOppManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/bluetooth/BluetoothOppManager.cpp b/dom/bluetooth/BluetoothOppManager.cpp index 7385bc372e73..a14eff95357b 100644 --- a/dom/bluetooth/BluetoothOppManager.cpp +++ b/dom/bluetooth/BluetoothOppManager.cpp @@ -160,7 +160,7 @@ public: MOZ_ASSERT(!NS_IsMainThread()); uint32_t numRead; - char* buf = new char[mAvailablePacketSize]; + nsAutoArrayPtr buf(new char[mAvailablePacketSize]); // function inputstream->Read() only works on non-main thread nsresult rv = mInputStream->Read(buf, mAvailablePacketSize, &numRead); @@ -176,7 +176,7 @@ public: } nsRefPtr task = - new SendSocketDataTask((uint8_t*)buf, numRead); + new SendSocketDataTask((uint8_t*)buf.forget(), numRead); if (NS_FAILED(NS_DispatchToMainThread(task))) { NS_WARNING("Failed to dispatch to main thread!"); return NS_ERROR_FAILURE;