Bug 981239: Use atomic ref-counting for |UnixSocketConsumer|, r=kyle

|SocketSendTask| acquires a reference to |UnixSocketConsumer| on
the main thread and releases this reference on the I/O thread;
leading to race-conditions. This patch adds

  - atomicity for ref-counting of |UnixSocketConsumer|, and
  - stricter tests in the destructor of this class.
This commit is contained in:
Thomas Zimmermann 2014-04-08 09:27:47 +02:00
parent b38304a595
commit 88cf1c0e54
2 changed files with 3 additions and 1 deletions

View File

@ -739,6 +739,8 @@ UnixSocketConsumer::UnixSocketConsumer() : mImpl(nullptr)
UnixSocketConsumer::~UnixSocketConsumer()
{
MOZ_ASSERT(mConnectionStatus == SOCKET_DISCONNECTED);
MOZ_ASSERT(!mImpl);
}
bool

View File

@ -135,7 +135,7 @@ enum SocketConnectionStatus {
SOCKET_CONNECTED = 3
};
class UnixSocketConsumer : public RefCounted<UnixSocketConsumer>
class UnixSocketConsumer : public AtomicRefCounted<UnixSocketConsumer>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(UnixSocketConsumer)