Bug 844705 - Should send socket data in main thread, r=echou

This commit is contained in:
Gina Yeh 2013-02-26 18:53:44 +08:00
parent 53600c9d44
commit f94a074431

View File

@ -160,7 +160,7 @@ public:
MOZ_ASSERT(!NS_IsMainThread());
uint32_t numRead;
char* buf = new char[mAvailablePacketSize];
nsAutoArrayPtr<char> 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<SendSocketDataTask> 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;