Bug 545757: Don't post replies to the IO thread after a connection error. r=bent
--- a/ipc/glue/RPCChannel.cpp
+++ b/ipc/glue/RPCChannel.cpp
@@ -434,19 +434,23 @@ RPCChannel::DispatchIncall(const Message
reply = new Message();
reply->set_rpc();
reply->set_reply();
reply->set_reply_error();
}
reply->set_seqno(call.seqno());
- mIOLoop->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &RPCChannel::OnSend, reply));
+ {
+ MutexAutoLock lock(mMutex);
+ if (ChannelConnected == mChannelState)
+ mIOLoop->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &RPCChannel::OnSend, reply));
+ }
}
bool
RPCChannel::BlockChild()
{
AssertWorkerThread();
if (mChild)
--- a/ipc/glue/SyncChannel.cpp
+++ b/ipc/glue/SyncChannel.cpp
@@ -163,19 +163,23 @@ SyncChannel::OnDispatchMessage(const Mes
reply = new Message();
reply->set_sync();
reply->set_reply();
reply->set_reply_error();
}
reply->set_seqno(msg.seqno());
- mIOLoop->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &SyncChannel::OnSend, reply));
+ {
+ MutexAutoLock lock(mMutex);
+ if (ChannelConnected == mChannelState)
+ mIOLoop->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &SyncChannel::OnSend, reply));
+ }
}
//
// The methods below run in the context of the IO thread, and can proxy
// back to the methods above
//
void